-
Notifications
You must be signed in to change notification settings - Fork 208
/
Exception.ts
35 lines (32 loc) · 1.3 KB
/
Exception.ts
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
27
28
29
30
31
32
33
34
35
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
* @module Quantity
*/
import { assert, BentleyError } from "@itwin/core-bentley";
/**
* Status codes used during Quantity parsing and formatting processing.
* @beta
*/
export enum QuantityStatus {
QUANTITY_ERROR_BASE = 0x88DF,
Success = 0,
InvalidJson = QUANTITY_ERROR_BASE + 1,
InvalidCompositeFormat = QUANTITY_ERROR_BASE + 2,
UnableToGenerateParseTokens = QUANTITY_ERROR_BASE + 3,
NoValueOrUnitFoundInString = QUANTITY_ERROR_BASE + 4,
UnitLabelSuppliedButNotMatched = QUANTITY_ERROR_BASE + 5,
UnknownUnit = QUANTITY_ERROR_BASE + 6,
UnableToConvertParseTokensToQuantity = QUANTITY_ERROR_BASE + 7,
}
/** The error type thrown by this module. See [[QuantityStatus]] for `errorNumber` values.
* @beta
*/
export class QuantityError extends BentleyError {
public constructor(public override readonly errorNumber: number, message?: string) {
super(errorNumber, message);
assert(errorNumber !== QuantityStatus.Success, message);
}
}