Spicy
exception.h
1 // Copyright (c) 2020-2021 by the Zeek Project. See LICENSE for details.
2 
3 #pragma once
4 
5 #include <hilti/ast/operators/common.h>
6 #include <hilti/ast/types/exception.h>
7 
8 namespace hilti {
9 namespace operator_ {
10 
11 BEGIN_CTOR(exception, Ctor)
12  auto ctorType() const { return type::Exception(type::Wildcard()); }
13 
14  auto signature() const {
15  return Signature{.args = {{.id = "msg", .type = type::String()}}, .doc = R"(
16 Instantiates an instance of the exception type carrying the error message *msg*.
17 )"};
18  }
19 END_CTOR
20 
21 BEGIN_METHOD(exception, Description)
22  auto signature() const {
23  return Signature{.self = type::Exception(type::Wildcard()),
24  .result = type::String(),
25  .id = "description",
26  .args = {},
27  .doc = R"(
28 Returns the textual message associated with an exception object.
29 )"};
30  }
31 END_METHOD
32 } // namespace operator_
33 } // namespace hilti