New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

magicbell

Package Overview
Dependencies
Maintainers
2
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

magicbell - npm Package Compare versions

Comparing version 2.3.1 to 2.4.0

errors.cjs

17

CHANGELOG.md
# magicbell
## 2.4.0
### Minor Changes
- [#192](https://github.com/magicbell-io/magicbell-js/pull/192) [`725ab1a`](https://github.com/magicbell-io/magicbell-js/commit/725ab1ad14619341beee9d4422da9ecce27a7e7e) Thanks [@smeijer](https://github.com/smeijer)! - Custom errors now include a `responseBody` property that holds the returned response
from the API, when available. Custom errors are now also exported so they can be
used with comparisons like `err instanceof MagicBellError`. Note that all errors
extend the `MagicBellError` base class.
They're exported from the root and `/errors`. For the sake of tree shaking, we
recommend using the latter.
```ts
import { MagicBellError, UnauthorizedError } from 'magicbell';
import { MagicBellError, UnauthorizedError } from 'magicbell/errors';
```
## 2.3.1

@@ -4,0 +21,0 @@

57

client/error.d.ts

@@ -10,2 +10,3 @@ export declare function createError(rawError: ErrorConfig): AuthenticationError | InvalidRequestError | APIError | RateLimitError | IdempotencyError | NotFoundError | UserInputError | UnknownError;

statusText?: string;
responseBody?: unknown;
message: string;

@@ -18,33 +19,65 @@ suggestion?: string;

*/
declare class BaseError extends Error {
export declare class MagicBellError extends Error {
/**
* The name of the error.
*/
name: string;
/**
* The error message returned by the REST API.
*/
message: string;
/**
* The type of the error.
*/
type?: string;
docs_url?: string;
/**
* The URL to the documentation for the error.
*/
docsUrl?: string;
/**
* The error code returned by the REST API.
*/
code?: string;
/**
* The HTTP status code returned by the REST API.
*/
status?: number;
/**
* The HTTP status text returned by the REST API.
*/
statusText?: string;
/**
* A suggestion on how to fix the error.
*/
suggestion?: string;
/**
* The raw response body returned by the REST API.
*/
responseBody?: unknown;
/**
* @deprecated - use docsUrl instead
*/
get docs_url(): string;
constructor(raw: ErrorConfig);
}
export declare class InvalidRequestError extends BaseError {
export declare class InvalidRequestError extends MagicBellError {
}
export declare class UserInputError extends BaseError {
export declare class UserInputError extends MagicBellError {
}
export declare class APIError extends BaseError {
export declare class APIError extends MagicBellError {
}
export declare class AuthenticationError extends BaseError {
export declare class AuthenticationError extends MagicBellError {
}
export declare class PermissionError extends BaseError {
export declare class PermissionError extends MagicBellError {
}
export declare class RateLimitError extends BaseError {
export declare class RateLimitError extends MagicBellError {
}
export declare class ConnectionError extends BaseError {
export declare class ConnectionError extends MagicBellError {
}
export declare class IdempotencyError extends BaseError {
export declare class IdempotencyError extends MagicBellError {
}
export declare class UnknownError extends BaseError {
export declare class UnknownError extends MagicBellError {
}
export declare class NotFoundError extends BaseError {
export declare class NotFoundError extends MagicBellError {
}
export {};
export type { RequestOptions } from './client/types';
export { createHmac } from './crypto';
export * from './errors';
export { type ProjectClientOptions, ProjectClient } from './project-client';
export { type UserClientOptions, UserClient } from './user-client';
{
"name": "magicbell",
"version": "2.3.1",
"version": "2.4.0",
"description": "MagicBell API wrapper",

@@ -33,2 +33,7 @@ "author": "MagicBell <bot@magicbell.io> (https://magicbell.com)",

"require": "./crypto.cjs"
},
"./errors": {
"types": "./errors.d.ts",
"import": "./errors.mjs",
"require": "./errors.cjs"
}

@@ -35,0 +40,0 @@ },

@@ -991,2 +991,34 @@ # MagicBell Node.js Library

## Errors
Errors returned by the SDK are instances of `MagicBellError`. This is a subclass of the native `Error` class, and contains the properties defined below. Error types can be imported from `magicbell/errors`.
- **message** _String_
A human-readable message providing more details about the error.
- **code** _String_
A short machine-readable string identifying the error.
- **status** _Number_
The HTTP status code returned by the API.
- **statusText** _String_
The HTTP status text returned by the API.
- **responseBody** _unknown_
The raw response body returned by the API
- **suggestion** _String_
A suggestion to resolve the error.
- **docsUrl** _String_
A link to the documentation for the error.
## Support

@@ -993,0 +1025,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc