dmd.errors
Functions for raising errors
.
License
Source: errors.d
Documentation: https://dlang.org/phobos/dmd_errors.html
-
Declaration
enum
ErrorKind
: int;Constants used to discriminate kinds of error messages.
-
Declaration
class
ErrorSinkCompiler
: dmd.errorsink.ErrorSink;Error message sink for D compiler.
-
Declaration
enum
Classification
: Color;Color highlighting to classify messages
-
Declaration
error
for errors
-
Declaration
gagged
for
gagged
errors -
Declaration
warning
for warnings
-
Declaration
deprecation
for deprecations
-
Declaration
tip
for
tip
messages
-
-
Declaration
nothrow void
error
(const ref Locloc
, const(char)*format
, ...);Print an
error
message, increasing the globalerror
count.Parameters
Loc
loc
location of
error
const(char)*
format
printf-style
format
specification...
printf-style variadic arguments
-
Declaration
nothrow void
error
(const(char)*filename
, uintlinnum
, uintcharnum
, const(char)*format
, ...);Same as above, but takes a
filename
and line information arguments as separate parameters.Parameters
const(char)*
filename
source file of
error
uint
linnum
line in the source file
uint
charnum
column number on the line
const(char)*
format
printf-style
format
specification...
printf-style variadic arguments
-
Declaration
nothrow void
errorSupplemental
(const ref Locloc
, const(char)*format
, ...);Print additional details about an error message. Doesn't increase the error count or print an additional error prefix.
Parameters
Loc
loc
location of error
const(char)*
format
printf-style
format
specification...
printf-style variadic arguments
-
Declaration
nothrow void
warning
(const ref Locloc
, const(char)*format
, ...);Print a
warning
message, increasing the globalwarning
count.Parameters
Loc
loc
location of
warning
const(char)*
format
printf-style
format
specification...
printf-style variadic arguments
-
Declaration
nothrow void
warningSupplemental
(const ref Locloc
, const(char)*format
, ...);Print additional details about a warning message. Doesn't increase the warning count or print an additional warning prefix.
Parameters
Loc
loc
location of warning
const(char)*
format
printf-style
format
specification...
printf-style variadic arguments
-
Declaration
nothrow void
deprecation
(const ref Locloc
, const(char)*format
, ...);Print a
deprecation
message, may increase the global warning or error count depending on whether deprecations are ignored.Parameters
Loc
loc
location of
deprecation
const(char)*
format
printf-style
format
specification...
printf-style variadic arguments
-
Declaration
nothrow void
deprecationSupplemental
(const ref Locloc
, const(char)*format
, ...);Print additional details about a deprecation message. Doesn't increase the error count, or print an additional deprecation prefix.
Parameters
Loc
loc
location of deprecation
const(char)*
format
printf-style
format
specification...
printf-style variadic arguments
-
Declaration
nothrow void
message
(const ref Locloc
, const(char)*format
, ...);Print a verbose
message
. Doesn't prefix or highlight messages.Parameters
Loc
loc
location of
message
const(char)*
format
printf-style
format
specification...
printf-style variadic arguments
-
Declaration
nothrow void
message
(const(char)*format
, ...);Same as above, but doesn't take a location argument.
Parameters
const(char)*
format
printf-style
format
specification...
printf-style variadic arguments
-
Declaration
alias
DiagnosticHandler
= bool delegate(ref const(Loc) location, Color headerColor, const(char)* header, const(char)* messageFormat, __va_list_tag* args, const(char)* prefix1, const(char)* prefix2) nothrow;The type of the diagnostic handler see verrorReport for arguments
Return Value
true
if error handling is done,false
to continue printing to stderr -
Declaration
DiagnosticHandler
diagnosticHandler
;The diagnostic handler. If non-
null
it will be called for every diagnostic message issued by the compiler. If it returnsfalse
, the message will be printed to stderr as usual. -
Declaration
nothrow void
tip
(const(char)*format
, ...);Print a
tip
message with the prefix and highlighting.Parameters
const(char)*
format
printf-style
format
specification...
printf-style variadic arguments
-
Declaration
nothrow void
verrorReport
(const ref Locloc
, const(char)*format
, va_listap
, ErrorKindkind
, const(char)*p1
= null, const(char)*p2
= null);Implements , , , , and . Report a diagnostic error, taking a va_list parameter, and optionally additional message prefixes. Whether the message gets printed depends on runtime values of DiagnosticReporting and global gagging.
Parameters
Loc
loc
location of error
const(char)*
format
printf-style
format
specificationva_list
ap
printf-style variadic arguments
ErrorKind
kind
kind
of error being printedconst(char)*
p1
additional message prefix
const(char)*
p2
additional message prefix
-
Declaration
nothrow void
verrorReportSupplemental
(const ref Locloc
, const(char)*format
, va_listap
, ErrorKindkind
);Implements , , and . Report an addition diagnostic error, taking a va_list parameter. Whether the message gets printed depends on runtime values of DiagnosticReporting and global gagging.
Parameters
Loc
loc
location of error
const(char)*
format
printf-style
format
specificationva_list
ap
printf-style variadic arguments
ErrorKind
kind
kind
of error being printed -
Declaration
alias
FatalErrorHandler
= bool delegate() nothrow;The type of the fatal error handler
Return Value
true
if error handling is done,false
to do exit(EXIT_FAILURE) -
Declaration
FatalErrorHandler
fatalErrorHandler
;The fatal error handler. If non-
null
it will be called for every fatal() call issued by the compiler. -
Declaration
nothrow void
fatal
();Call this after printing out
fatal
error messages to clean up and exit the compiler. You can also set a fatalErrorHandler to override this behaviour. -
Declaration
nothrow @safe void
halt
();Try to stop forgetting to remove the breakpoints from release builds.
-
Declaration
enum
HIGHLIGHT
: ubyte;Embed these highlighting commands in the text stream.
HIGHLIGHT
.Escape indicates a Color follows.