/proc/self/cwd/eval/internal/errors.cc
Line | Count | Source |
1 | | // Copyright 2022 Google LLC |
2 | | // |
3 | | // Licensed under the Apache License, Version 2.0 (the "License"); |
4 | | // you may not use this file except in compliance with the License. |
5 | | // You may obtain a copy of the License at |
6 | | // |
7 | | // https://www.apache.org/licenses/LICENSE-2.0 |
8 | | // |
9 | | // Unless required by applicable law or agreed to in writing, software |
10 | | // distributed under the License is distributed on an "AS IS" BASIS, |
11 | | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | | // See the License for the specific language governing permissions and |
13 | | // limitations under the License. |
14 | | |
15 | | #include "eval/internal/errors.h" |
16 | | |
17 | | #include "absl/status/status.h" |
18 | | #include "absl/strings/string_view.h" |
19 | | #include "runtime/internal/errors.h" |
20 | | #include "google/protobuf/arena.h" |
21 | | |
22 | | namespace cel { |
23 | | namespace interop_internal { |
24 | | |
25 | | using ::google::protobuf::Arena; |
26 | | |
27 | | const absl::Status* CreateNoMatchingOverloadError(google::protobuf::Arena* arena, |
28 | 0 | absl::string_view fn) { |
29 | 0 | return Arena::Create<absl::Status>( |
30 | 0 | arena, runtime_internal::CreateNoMatchingOverloadError(fn)); |
31 | 0 | } |
32 | | |
33 | | const absl::Status* CreateNoSuchFieldError(google::protobuf::Arena* arena, |
34 | 284 | absl::string_view field) { |
35 | 284 | return Arena::Create<absl::Status>( |
36 | 284 | arena, runtime_internal::CreateNoSuchFieldError(field)); |
37 | 284 | } |
38 | | |
39 | | const absl::Status* CreateNoSuchKeyError(google::protobuf::Arena* arena, |
40 | 0 | absl::string_view key) { |
41 | 0 | return Arena::Create<absl::Status>( |
42 | 0 | arena, runtime_internal::CreateNoSuchKeyError(key)); |
43 | 0 | } |
44 | | |
45 | | const absl::Status* CreateMissingAttributeError( |
46 | 0 | google::protobuf::Arena* arena, absl::string_view missing_attribute_path) { |
47 | 0 | return Arena::Create<absl::Status>( |
48 | 0 | arena, |
49 | 0 | runtime_internal::CreateMissingAttributeError(missing_attribute_path)); |
50 | 0 | } |
51 | | |
52 | | const absl::Status* CreateUnknownFunctionResultError( |
53 | 0 | google::protobuf::Arena* arena, absl::string_view help_message) { |
54 | 0 | return Arena::Create<absl::Status>( |
55 | 0 | arena, runtime_internal::CreateUnknownFunctionResultError(help_message)); |
56 | 0 | } |
57 | | |
58 | | const absl::Status* CreateError(google::protobuf::Arena* arena, absl::string_view message, |
59 | 0 | absl::StatusCode code) { |
60 | 0 | return Arena::Create<absl::Status>(arena, code, message); |
61 | 0 | } |
62 | | |
63 | | } // namespace interop_internal |
64 | | } // namespace cel |