File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed
libs/common/src/platform/abstractions/sdk Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -12,17 +12,27 @@ export class UserNotLoggedInError extends Error {
1212 }
1313}
1414
15- // Converts a string to UUID. Will throw an error if the UUID is non valid.
16- export function uuid < T extends Uuid > ( uuid : string ) : T {
15+ export class InvalidUuid extends Error {
16+ constructor ( uuid : string ) {
17+ super ( `Invalid UUID: ${ uuid } ` ) ;
18+ }
19+ }
20+
21+ /**
22+ * Converts a string to UUID. Will throw an error if the UUID is non valid.
23+ */
24+ export function asUuid < T extends Uuid > ( uuid : string ) : T {
1725 if ( Utils . isGuid ( uuid ) ) {
1826 return uuid as T ;
1927 }
2028
21- throw new Error ( `Invalid UUID: ${ uuid } ` ) ;
29+ throw new InvalidUuid ( uuid ) ;
2230}
2331
24- // Converts a UUID to the string representation.
25- export function uuid_to_string < T extends Uuid > ( uuid : T ) : string {
32+ /**
33+ * Converts a UUID to the string representation.
34+ */
35+ export function uuidToString < T extends Uuid > ( uuid : T ) : string {
2636 return uuid as unknown as string ;
2737}
2838
You can’t perform that action at this time.
0 commit comments