forked from carbon-language/carbon-lang
-
Notifications
You must be signed in to change notification settings - Fork 0
/
error_builders.h
26 lines (19 loc) · 845 Bytes
/
error_builders.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#ifndef CARBON_EXPLORER_BASE_ERROR_BUILDERS_H_
#define CARBON_EXPLORER_BASE_ERROR_BUILDERS_H_
#include "common/error.h"
#include "explorer/base/source_location.h"
namespace Carbon {
// Builds an Error instance with the specified message. This should be used
// for errors in the user-supplied Carbon code is incorrect. Use CHECK/FATAL
// instead for errors that indicate bugs in Explorer itself.
//
// For example:
// return ProgramError(line_num) << "Line is bad!";
inline auto ProgramError(SourceLocation loc) -> ErrorBuilder {
return ErrorBuilder(loc.ToString());
}
} // namespace Carbon
#endif // CARBON_EXPLORER_BASE_ERROR_BUILDERS_H_