Ben Clayton | af48bbc | 2021-09-28 11:59:10 +0000 | [diff] [blame] | 1 | // Copyright 2021 The Dawn Authors |
| 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 | // http://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 | #ifndef DAWN_NODE_BINDING_ERRORS_H_ |
| 16 | #define DAWN_NODE_BINDING_ERRORS_H_ |
| 17 | |
| 18 | #include "napi.h" |
| 19 | |
| 20 | namespace wgpu { namespace binding { |
| 21 | |
| 22 | // Errors contains static helper methods for creating DOMException error |
| 23 | // messages as documented at: |
| 24 | // https://heycam.github.io/webidl/#idl-DOMException-error-names |
| 25 | class Errors { |
| 26 | public: |
| 27 | static Napi::Error HierarchyRequestError(Napi::Env); |
| 28 | static Napi::Error WrongDocumentError(Napi::Env); |
| 29 | static Napi::Error InvalidCharacterError(Napi::Env); |
| 30 | static Napi::Error NoModificationAllowedError(Napi::Env); |
| 31 | static Napi::Error NotFoundError(Napi::Env); |
| 32 | static Napi::Error NotSupportedError(Napi::Env); |
| 33 | static Napi::Error InUseAttributeError(Napi::Env); |
| 34 | static Napi::Error InvalidStateError(Napi::Env); |
| 35 | static Napi::Error SyntaxError(Napi::Env); |
| 36 | static Napi::Error InvalidModificationError(Napi::Env); |
| 37 | static Napi::Error NamespaceError(Napi::Env); |
| 38 | static Napi::Error SecurityError(Napi::Env); |
| 39 | static Napi::Error NetworkError(Napi::Env); |
| 40 | static Napi::Error AbortError(Napi::Env); |
| 41 | static Napi::Error URLMismatchError(Napi::Env); |
| 42 | static Napi::Error QuotaExceededError(Napi::Env); |
| 43 | static Napi::Error TimeoutError(Napi::Env); |
| 44 | static Napi::Error InvalidNodeTypeError(Napi::Env); |
| 45 | static Napi::Error DataCloneError(Napi::Env); |
| 46 | static Napi::Error EncodingError(Napi::Env); |
| 47 | static Napi::Error NotReadableError(Napi::Env); |
| 48 | static Napi::Error UnknownError(Napi::Env); |
| 49 | static Napi::Error ConstraintError(Napi::Env); |
| 50 | static Napi::Error DataError(Napi::Env); |
| 51 | static Napi::Error TransactionInactiveError(Napi::Env); |
| 52 | static Napi::Error ReadOnlyError(Napi::Env); |
| 53 | static Napi::Error VersionError(Napi::Env); |
| 54 | static Napi::Error OperationError(Napi::Env); |
| 55 | static Napi::Error NotAllowedError(Napi::Env); |
| 56 | }; |
| 57 | |
| 58 | }} // namespace wgpu::binding |
| 59 | |
| 60 | #endif // DAWN_NODE_BINDING_ERRORS_H_ |