@keiser/metrics-sdk
Advanced tools
Comparing version 0.4.3 to 0.5.0
{ | ||
"name": "@keiser/metrics-sdk", | ||
"version": "0.4.3", | ||
"version": "0.5.0", | ||
"description": "Keiser Metrics SDK", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -107,3 +107,3 @@ # Keiser Metrics SDK | ||
All errors will be in the same format which includes a `code` value that can be used to determine the type of error, as well as a `message`. | ||
All errors will be thrown as a typed error instance corresponding to the reason for the error, with the global [`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) as the base instance, and an intermediate category type inheritance (for easier bucketing). | ||
@@ -114,5 +114,11 @@ ```ts | ||
userSession = await metrics.authenticateWithCredentials({email: 'demo@keiser.com', password: 'wrongPassword'}) | ||
} catch (exception) { | ||
if (exception.error.code === 603) { | ||
this.userCredentialsIncorrect() | ||
} catch (error) { | ||
if (error instanceof RequestError) { | ||
if (error instanceof InvalidCredentialsError) { | ||
this.userCredentialsIncorrect() | ||
} else if (error instanceof ValidationError) { | ||
this.userCredentialsValidationError() | ||
} | ||
} else if (error instanceof ServerError) { | ||
this.serverDown() | ||
} | ||
@@ -122,17 +128,24 @@ } | ||
### Error Categories | ||
| Name | Purpose | | ||
| --------------- | ------------------------------------------------------------ | | ||
| RequestError | Issue with the parameters provided for the request | | ||
| SessionError | Issue with the session instance (session is no longer valid) | | ||
| ServerError | Issue with the server (potentially overloaded or offline) | | ||
| ConnectionError | Issue with connection to server | | ||
### Common Errors | ||
| Code | Name | Message | | ||
| ---- | ---- | ------- | | ||
| 601 | MissingParams | missing parameter(s) for action | | ||
| 603 | InvalidCredentials | credentials do not match any active users | | ||
| 604 | ValidationError | validation error in parameters | | ||
| 605 | UnknownEntity | entity does not exist | | ||
| 606 | DuplicateEntity | entity already exists | | ||
| 621 | UnauthorizedResource | unauthorized to access resource | | ||
| 625 | ActionPrevented | action cannot be performed | | ||
| 630 | FacilityAccessControlError | action is prevented due to facility access control limitations | | ||
| Name | Category | Message | | ||
| --------------------- | ------------ | -------------------------------------------------------------- | | ||
| MissingParams | RequestError | missing parameter(s) for action | | ||
| InvalidCredentials | RequestError | credentials do not match any active users | | ||
| Validation | RequestError | validation error in parameters | | ||
| UnknownEntity | RequestError | entity does not exist | | ||
| DuplicateEntity | RequestError | entity already exists | | ||
| UnauthorizedResource | RequestError | unauthorized to access resource | | ||
| ActionPrevented | RequestError | action cannot be performed | | ||
| FacilityAccessControl | RequestError | action is prevented due to facility access control limitations | | ||
A full list of errors is available here: [Metrics API Errors List](https://metrics-api.keiser.com/api?action=core:errors) | ||
## Closing Connection | ||
@@ -139,0 +152,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
262189
34
1998
164