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

grpc-boom

Package Overview
Dependencies
Maintainers
1
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grpc-boom - npm Package Compare versions

Comparing version 2.0.0 to 2.0.2

92

index.d.ts

@@ -1,2 +0,2 @@

import { Metadata } from '@grpc/grpc-js';
import { Metadata, ServiceError } from '@grpc/grpc-js';

@@ -146,22 +146,26 @@ /**

/** constructor reference. */
ctor?: (details: string, metadata?: Metadata) => any;
/** error - the gRPC status details. */
ctor?: (message: string, metadata?: Metadata) => any;
/** error - the gRPC status message. */
error?: string;
/** details - the error details. */
details?: string | Error;
/** message - the error message. */
message?: string | Error;
}
export default class GrpcBoom extends Error {
export default class GrpcBoom implements ServiceError {
/** isBoom - if true, indicates this is a GrpcBoom object instance. */
public isBoom: boolean;
/** additional error information. */
public metadata?: Metadata;
public metadata: Metadata;
/** code - the gRPC status code. */
public code?: number;
/** error - the gRPC status details. */
public code: number;
/** error - the gRPC status message. */
public error?: string;
/** message - the error message. */
public message: string;
/** details - the error details. */
public details: string;
/** name - the error name. */
public name: string;
constructor(details: string, options?: Options);
constructor(message: string, options?: Options);

@@ -177,13 +181,13 @@ /**

* Not an error; returned on success
* @param details the details.
* @param message the message.
* @param metadata optional grpc metadata.
*/
public static ok(details: string, metadata?: Metadata): GrpcBoom;
public static ok(message: string, metadata?: Metadata): GrpcBoom;
/**
* The operation was cancelled (typically by the caller).
* @param details the error details.
* @param message the error message.
* @param metadata optional grpc metadata.
*/
public static cancelled(details: string, metadata?: Metadata): GrpcBoom;
public static cancelled(message: string, metadata?: Metadata): GrpcBoom;

@@ -196,6 +200,6 @@ /**

* may be converted to this error.
* @param details the error details.
* @param message the error message.
* @param metadata optional grpc metadata.
*/
public static unknown(details: string, metadata?: Metadata): GrpcBoom;
public static unknown(message: string, metadata?: Metadata): GrpcBoom;

@@ -207,6 +211,6 @@ /**

* (e.g., a malformed file name).
* @param details the error details.
* @param message the error message.
* @param metadata optional grpc metadata.
*/
public static invalidArgument(details: string, metadata?: Metadata): GrpcBoom;
public static invalidArgument(message: string, metadata?: Metadata): GrpcBoom;

@@ -219,13 +223,13 @@ /**

* enough for the deadline to expire.
* @param details the error details.
* @param message the error message.
* @param metadata optional grpc metadata.
*/
public static deadlineExceeded(details: string, metadata?: Metadata): GrpcBoom;
public static deadlineExceeded(message: string, metadata?: Metadata): GrpcBoom;
/**
* Some requested entity (e.g., file or directory) was not found.
* @param details the error details.
* @param message the error message.
* @param metadata optional grpc metadata.
*/
public static notFound(details: string, metadata?: Metadata): GrpcBoom;
public static notFound(message: string, metadata?: Metadata): GrpcBoom;

@@ -235,6 +239,6 @@ /**

* already exists.
* @param details the error details.
* @param message the error message.
* @param metadata optional grpc metadata.
*/
public static alreadyExists(details: string, metadata?: Metadata): GrpcBoom;
public static alreadyExists(message: string, metadata?: Metadata): GrpcBoom;

@@ -248,6 +252,6 @@ /**

* instead for those errors).
* @param details the error details.
* @param message the error message.
* @param metadata optional grpc metadata.
*/
public static permissionDenied(details: string, metadata?: Metadata): GrpcBoom;
public static permissionDenied(message: string, metadata?: Metadata): GrpcBoom;

@@ -257,6 +261,6 @@ /**

* perhaps the entire file system is out of space.
* @param details the error details.
* @param message the error message.
* @param metadata optional grpc metadata.
*/
public static resourceExhausted(details: string, metadata?: Metadata): GrpcBoom;
public static resourceExhausted(message: string, metadata?: Metadata): GrpcBoom;

@@ -284,6 +288,6 @@ /**

* read-modify-write on the same resource.
* @param details the error details.
* @param message the error message.
* @param metadata optional grpc metadata.
*/
public static failedPrecondition(details: string, metadata?: Metadata): GrpcBoom;
public static failedPrecondition(message: string, metadata?: Metadata): GrpcBoom;

@@ -296,6 +300,6 @@ /**

* ABORTED, and UNAVAILABLE.
* @param details the error details.
* @param message the error message.
* @param metadata optional grpc metadata.
*/
public static aborted(details: string, metadata?: Metadata): GrpcBoom;
public static aborted(message: string, metadata?: Metadata): GrpcBoom;

@@ -318,13 +322,13 @@ /**

* they are done.
* @param details the error details.
* @param message the error message.
* @param metadata optional grpc metadata.
*/
public static outOfRange(details: string, metadata?: Metadata): GrpcBoom;
public static outOfRange(message: string, metadata?: Metadata): GrpcBoom;
/**
* Operation is not implemented or not supported/enabled in this service.
* @param details the error details.
* @param message the error message.
* @param metadata optional grpc metadata.
*/
public static unimplemented(details: string, metadata?: Metadata): GrpcBoom;
public static unimplemented(message: string, metadata?: Metadata): GrpcBoom;

@@ -335,6 +339,6 @@ /**

* something is very broken.
* @param details the error details.
* @param message the error message.
* @param metadata optional grpc metadata.
*/
public static internal(details: string, metadata?: Metadata): GrpcBoom;
public static internal(message: string, metadata?: Metadata): GrpcBoom;

@@ -348,13 +352,13 @@ /**

* ABORTED, and UNAVAILABLE.
* @param details the error details.
* @param message the error message.
* @param metadata optional grpc metadata.
*/
public static unavailable(details: string, metadata?: Metadata): GrpcBoom;
public static unavailable(message: string, metadata?: Metadata): GrpcBoom;
/**
* Unrecoverable data loss or corruption.
* @param details the error details.
* @param message the error message.
* @param metadata optional grpc metadata.
*/
public static dataLoss(details: string, metadata?: Metadata): GrpcBoom;
public static dataLoss(message: string, metadata?: Metadata): GrpcBoom;

@@ -364,6 +368,6 @@ /**

* operation.
* @param details the error details.
* @param message the error message.
* @param metadata optional grpc metadata.
*/
public static unauthenticated(details: string, metadata?: Metadata): GrpcBoom;
public static unauthenticated(message: string, metadata?: Metadata): GrpcBoom;
}
{
"name": "grpc-boom",
"version": "2.0.0",
"version": "2.0.2",
"description": "A gRPC implementation of the awesome Boom library to help create gRPC-friendly error objects",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -47,21 +47,21 @@ # gRPC Boom

- [Helper Methods](#helper-methods)
- [`new GrpcBoom(details, [options])`](#new-grpcboommessage-options)
- [`new GrpcBoom(message, [options])`](#new-grpcboommessage-options)
- [`boomify(error, [options])`](#boomifyerror-options)
- [Convenience Methods](#convenience-methods)
- [`GrpcBoom.cancelled([details], [metadata])`](#grpcboomcancelledmessage-metadata)
- [`GrpcBoom.unknown([details], [metadata])`](#grpcboomunknownmessage-metadata)
- [`GrpcBoom.invalidArgument([details], [metadata])`](#grpcboominvalidargumentmessage-metadata)
- [`GrpcBoom.deadlineExceeded([details], [metadata])`](#grpcboomdeadlineexceededmessage-metadata)
- [`GrpcBoom.notFound([details], [metadata])`](#grpcboomnotfoundmessage-metadata)
- [`GrpcBoom.alreadyExists([details], [metadata])`](#grpcboomalreadyexistsmessage-metadata)
- [`GrpcBoom.permissionDenied([details], [metadata])`](#grpcboompermissiondeniedmessage-metadata)
- [`GrpcBoom.resourceExhausted([details], [metadata])`](#grpcboomresourceexhaustedmessage-metadata)
- [`GrpcBoom.failedPrecondition([details], [metadata])`](#grpcboomfailedpreconditionmessage-metadata)
- [`GrpcBoom.aborted([details], [metadata])`](#grpcboomabortedmessage-metadata)
- [`GrpcBoom.outOfRange([details], [metadata])`](#grpcboomoutofrangemessage-metadata)
- [`GrpcBoom.unimplemented([details], [metadata])`](#grpcboomunimplementedmessage-metadata)
- [`GrpcBoom.internal([details], [metadata])`](#grpcboominternalmessage-metadata)
- [`GrpcBoom.unavailable([details], [metadata])`](#grpcboomunavailablemessage-metadata)
- [`GrpcBoom.dataLoss([details], [metadata])`](#grpcboomdatalossmessage-metadata)
- [`GrpcBoom.unauthenticated([details], [metadata])`](#grpcboomunauthenticatedmessage-metadata)
- [`GrpcBoom.cancelled([message], [metadata])`](#grpcboomcancelledmessage-metadata)
- [`GrpcBoom.unknown([message], [metadata])`](#grpcboomunknownmessage-metadata)
- [`GrpcBoom.invalidArgument([message], [metadata])`](#grpcboominvalidargumentmessage-metadata)
- [`GrpcBoom.deadlineExceeded([message], [metadata])`](#grpcboomdeadlineexceededmessage-metadata)
- [`GrpcBoom.notFound([message], [metadata])`](#grpcboomnotfoundmessage-metadata)
- [`GrpcBoom.alreadyExists([message], [metadata])`](#grpcboomalreadyexistsmessage-metadata)
- [`GrpcBoom.permissionDenied([message], [metadata])`](#grpcboompermissiondeniedmessage-metadata)
- [`GrpcBoom.resourceExhausted([message], [metadata])`](#grpcboomresourceexhaustedmessage-metadata)
- [`GrpcBoom.failedPrecondition([message], [metadata])`](#grpcboomfailedpreconditionmessage-metadata)
- [`GrpcBoom.aborted([message], [metadata])`](#grpcboomabortedmessage-metadata)
- [`GrpcBoom.outOfRange([message], [metadata])`](#grpcboomoutofrangemessage-metadata)
- [`GrpcBoom.unimplemented([message], [metadata])`](#grpcboomunimplementedmessage-metadata)
- [`GrpcBoom.internal([message], [metadata])`](#grpcboominternalmessage-metadata)
- [`GrpcBoom.unavailable([message], [metadata])`](#grpcboomunavailablemessage-metadata)
- [`GrpcBoom.dataLoss([message], [metadata])`](#grpcboomdatalossmessage-metadata)
- [`GrpcBoom.unauthenticated([message], [metadata])`](#grpcboomunauthenticatedmessage-metadata)

@@ -78,4 +78,4 @@ <!-- tocstop -->

- `code` - the gRPC status code.
- `error` - the gRPC status details (e.g. 'INVALID_ARGUMENTS', 'INTERNAL').
- `details` - the error details.
- `error` - the gRPC status message (e.g. 'INVALID_ARGUMENTS', 'INTERNAL').
- `message` - the error message.

@@ -110,3 +110,3 @@ ## Usage

"error": "INVALID_ARGUMENT",
"details": "Length of 'Name' cannot be more than 10 characters"
"message": "Length of 'Name' cannot be more than 10 characters"
}

@@ -117,3 +117,3 @@ ```

See [`new GrpcBoom(details, [options])`](#new-grpcboommessage-options) for details.
See [`new GrpcBoom(message, [options])`](#new-grpcboommessage-options) for details.

@@ -138,3 +138,3 @@ ```typescript

isBoom: true
details: Constructor Example!
message: Constructor Example!
code: 1

@@ -167,3 +167,3 @@ error: CANCELLED

isBoom: true
details: Boomify Example!
message: Boomify Example!
code: 2

@@ -193,3 +193,3 @@ error: UNKNOWN

isBoom: true
details: Validation failed
message: Validation failed
code: 3

@@ -223,3 +223,3 @@ error: INVALID_ARGUMENT

isBoom: true
details: Custom Example!
message: Custom Example!
code: 200

@@ -234,11 +234,11 @@ error: CUSTOM_EXAMPLE

### `new GrpcBoom(details, [options])`
### `new GrpcBoom(message, [options])`
Creates a new `GrpcBoom` object using the provided `details` and decorates the error with `GrpcBoom` properties, where:
Creates a new `GrpcBoom` object using the provided `message` and decorates the error with `GrpcBoom` properties, where:
- `details` - the error details.
- `message` - the error message.
- `options` - and optional object where:
- `code` - the gRPC status code. Defaults to `2` if no status code is set.
- `metadata` - an optional gRPC `Metadata` object.
- `error` - the gRPC status details (e.g. 'INVALID_ARGUMENTS', 'INTERNAL').
- `error` - the gRPC status message (e.g. 'INVALID_ARGUMENTS', 'INTERNAL').

@@ -252,5 +252,5 @@ ### `boomify(error, [options])`

- `code` - the gRPC status code. Defaults to `2` if no status code is already set.
- `details` - the error details string
- `message` - the error message string
- `metadata` - an optional gRPC `Metadata` object.
- `error` - the gRPC status details (e.g. 'INVALID_ARGUMENTS', 'INTERNAL').
- `error` - the gRPC status message (e.g. 'INVALID_ARGUMENTS', 'INTERNAL').

@@ -268,3 +268,3 @@ ```typescript

"error": "INVALID_ARGUMENT",
"details": "Unexpected input"
"message": "Unexpected input"
}

@@ -277,7 +277,7 @@ ```

### `GrpcBoom.cancelled([details], [metadata])`
### `GrpcBoom.cancelled([message], [metadata])`
Returns a `1` Cancelled error where:
- `details` - optional details.
- `message` - optional message.
- `metadata` - optional gRPC `Metadata` object.

@@ -295,11 +295,11 @@

"error": "CANCELLED",
"details": "Operation was cancelled"
"message": "Operation was cancelled"
}
```
### `GrpcBoom.unknown([details], [metadata])`
### `GrpcBoom.unknown([message], [metadata])`
Returns a `2` Unknown error where:
- `details` - optional details.
- `message` - optional message.
- `metadata` - optional gRPC `Metadata` object

@@ -317,11 +317,11 @@

"error": "UNKNOWN",
"details": "Unknown error"
"message": "Unknown error"
}
```
### `GrpcBoom.invalidArgument([details], [metadata])`
### `GrpcBoom.invalidArgument([message], [metadata])`
Returns a `3` Invalid Argument error where:
- `details` - optional details.
- `message` - optional message.
- `metadata` - optional gRPC `Metadata` object

@@ -339,11 +339,11 @@

"error": "INVALID_ARGUMENT",
"details": "Invalid query"
"message": "Invalid query"
}
```
### `GrpcBoom.deadlineExceeded([details], [metadata])`
### `GrpcBoom.deadlineExceeded([message], [metadata])`
Returns a `4` Deadline Exceeded error where:
- `details` - optional details.
- `message` - optional message.
- `metadata` - optional gRPC `Metadata` object

@@ -361,11 +361,11 @@

"error": "DEADLINE_EXCEEDED",
"details": "Deadline expired before operation could complete"
"message": "Deadline expired before operation could complete"
}
```
### `GrpcBoom.notFound([details], [metadata])`
### `GrpcBoom.notFound([message], [metadata])`
Returns a `5` Not Found error where:
- `details` - optional details.
- `message` - optional message.
- `metadata` - optional gRPC `Metadata` object

@@ -383,11 +383,11 @@

"error": "NOT_FOUND",
"details": "Requested entity was not found"
"message": "Requested entity was not found"
}
```
### `GrpcBoom.alreadyExists([details], [metadata])`
### `GrpcBoom.alreadyExists([message], [metadata])`
Returns a `6` Already Exists error where:
- `details` - optional details.
- `message` - optional message.
- `metadata` - optional gRPC `Metadata` object

@@ -405,11 +405,11 @@

"error": "ALREADY_EXISTS",
"details": "Requested entity already exists"
"message": "Requested entity already exists"
}
```
### `GrpcBoom.permissionDenied([details], [metadata])`
### `GrpcBoom.permissionDenied([message], [metadata])`
Returns a `7` Permission Denied error where:
- `details` - optional details.
- `message` - optional message.
- `metadata` - optional gRPC `Metadata` object

@@ -427,11 +427,11 @@

"error": "PERMISSION_DENIED",
"details": "The caller does not have permission to execute the specified operation"
"message": "The caller does not have permission to execute the specified operation"
}
```
### `GrpcBoom.resourceExhausted([details], [metadata])`
### `GrpcBoom.resourceExhausted([message], [metadata])`
Returns a `8` Resource Exhausted error where:
- `details` - optional details.
- `message` - optional message.
- `metadata` - optional gRPC `Metadata` object

@@ -449,11 +449,11 @@

"error": "RESOURCE_EXHAUSTED",
"details": "Resource has been exhausted"
"message": "Resource has been exhausted"
}
```
### `GrpcBoom.failedPrecondition([details], [metadata])`
### `GrpcBoom.failedPrecondition([message], [metadata])`
Returns a `9` Failed Precondition error where:
- `details` - optional details.
- `message` - optional message.
- `metadata` - optional gRPC `Metadata` object

@@ -473,11 +473,11 @@

"error": "FAILED_PRECONDITION",
"details": "Operation was rejected because the system is not in a state required for the operations execution"
"message": "Operation was rejected because the system is not in a state required for the operations execution"
}
```
### `GrpcBoom.aborted([details], [metadata])`
### `GrpcBoom.aborted([message], [metadata])`
Returns a `10` Aborted error where:
- `details` - optional details.
- `message` - optional message.
- `metadata` - optional gRPC `Metadata` object

@@ -495,11 +495,11 @@

"error": "ABORTED",
"details": "The operation was aborted"
"message": "The operation was aborted"
}
```
### `GrpcBoom.outOfRange([details], [metadata])`
### `GrpcBoom.outOfRange([message], [metadata])`
Returns a `11` Out of Range error where:
- `details` - optional details.
- `message` - optional message.
- `metadata` - optional gRPC `Metadata` object

@@ -517,11 +517,11 @@

"error": "OUT_OF_RANGE",
"details": "Operation was attempted past the valid range"
"message": "Operation was attempted past the valid range"
}
```
### `GrpcBoom.unimplemented([details], [metadata])`
### `GrpcBoom.unimplemented([message], [metadata])`
Returns a `12` Unimplemented error where:
- `details` - optional details.
- `message` - optional message.
- `metadata` - optional gRPC `Metadata` object

@@ -539,11 +539,11 @@

"error": "UNIMPLEMENTED",
"details": "Operation is not implemented or not supported/enabled"
"message": "Operation is not implemented or not supported/enabled"
}
```
### `GrpcBoom.internal([details], [metadata])`
### `GrpcBoom.internal([message], [metadata])`
Returns a `13` Internal error where:
- `details` - optional details.
- `message` - optional message.
- `metadata` - optional gRPC `Metadata` object

@@ -561,11 +561,11 @@

"error": "INTERNAL",
"details": "Internal errors"
"message": "Internal errors"
}
```
### `GrpcBoom.unavailable([details], [metadata])`
### `GrpcBoom.unavailable([message], [metadata])`
Returns a `14` Unavailable error where:
- `details` - optional details.
- `message` - optional message.
- `metadata` - optional gRPC `Metadata` object

@@ -583,11 +583,11 @@

"error": "UNAVAILABLE",
"details": "The service is currently unavailable"
"message": "The service is currently unavailable"
}
```
### `GrpcBoom.dataLoss([details], [metadata])`
### `GrpcBoom.dataLoss([message], [metadata])`
Returns a `15` Data Loss error where:
- `details` - optional details.
- `message` - optional message.
- `metadata` - optional gRPC `Metadata` object

@@ -605,11 +605,11 @@

"error": "DATA_LOSS",
"details": "Unrecoverable data loss or corruption"
"message": "Unrecoverable data loss or corruption"
}
```
### `GrpcBoom.unauthenticated([details], [metadata])`
### `GrpcBoom.unauthenticated([message], [metadata])`
Returns a `16` Unauthenticated error where:
- `details` - optional details.
- `message` - optional message.
- `metadata` - optional gRPC `Metadata` object

@@ -629,3 +629,3 @@

"error": "UNAUTHENTICATED",
"details": "The request does not have valid authentication credentials for the operation"
"message": "The request does not have valid authentication credentials for the operation"
}

@@ -632,0 +632,0 @@ ```

@@ -24,21 +24,17 @@ "use strict";

})(Status = exports.Status || (exports.Status = {}));
class GrpcBoom extends Error {
constructor(details, options) {
super(details);
class GrpcBoom {
constructor(message, options) {
const code = options && options.code !== undefined ? options.code : GrpcBoom.fallbackStatus;
const ctor = options && options.ctor !== undefined ? options.ctor : GrpcBoom;
const error = options && options.error !== undefined ? options.error : undefined;
const errorInstance = new Error(details !== undefined ? details : undefined);
errorInstance.isBoom = true;
errorInstance.code = code;
errorInstance.error = error;
errorInstance.details = details;
errorInstance.reformat = this.reformat;
errorInstance.initialize = this.initialize;
this.name = 'Error';
this.isBoom = true;
this.code = code;
this.error = error;
this.message = message;
if (options && options.metadata !== undefined) {
errorInstance.metadata = options.metadata;
this.metadata = options.metadata;
}
errorInstance.reformat();
Error.captureStackTrace(errorInstance, ctor);
return errorInstance;
this.reformat();
Error.captureStackTrace(this, ctor);
}

@@ -49,6 +45,5 @@ static [Symbol.hasInstance](instance) {

static boomify(errorInstance, options) {
var _a, _b;
let details = (_b = (_a = errorInstance.message) !== null && _a !== void 0 ? _a : errorInstance.details) !== null && _b !== void 0 ? _b : GrpcBoom.fallbackMessage;
if (options && options.details && !(options.details instanceof Error)) {
details = options.details;
let message = errorInstance && errorInstance.message ? errorInstance.message : GrpcBoom.fallbackMessage;
if (options && options.message && !(options.message instanceof Error)) {
message = options.message;
}

@@ -64,3 +59,3 @@ let code = errorInstance && errorInstance.code ? errorInstance.code : GrpcBoom.fallbackStatus;

if (errorInstance && errorInstance.isBoom) {
errorInstance.details = details;
errorInstance.message = message;
errorInstance.code = code;

@@ -74,57 +69,57 @@ errorInstance.error = error;

}
return new GrpcBoom(details, newOptions);
return new GrpcBoom(message, newOptions);
}
static ok(details, metadata) {
return this.create(details, Status.OK, metadata, this.ok);
static ok(message, metadata) {
return this.create(message, Status.OK, metadata, this.ok);
}
static cancelled(details, metadata) {
return this.create(details, Status.CANCELLED, metadata, this.cancelled);
static cancelled(message, metadata) {
return this.create(message, Status.CANCELLED, metadata, this.cancelled);
}
static unknown(details, metadata) {
return this.create(details, Status.UNKNOWN, metadata, this.unknown);
static unknown(message, metadata) {
return this.create(message, Status.UNKNOWN, metadata, this.unknown);
}
static invalidArgument(details, metadata) {
return this.create(details, Status.INVALID_ARGUMENT, metadata, this.invalidArgument);
static invalidArgument(message, metadata) {
return this.create(message, Status.INVALID_ARGUMENT, metadata, this.invalidArgument);
}
static deadlineExceeded(details, metadata) {
return this.create(details, Status.DEADLINE_EXCEEDED, metadata, this.deadlineExceeded);
static deadlineExceeded(message, metadata) {
return this.create(message, Status.DEADLINE_EXCEEDED, metadata, this.deadlineExceeded);
}
static notFound(details, metadata) {
return this.create(details, Status.NOT_FOUND, metadata, this.notFound);
static notFound(message, metadata) {
return this.create(message, Status.NOT_FOUND, metadata, this.notFound);
}
static alreadyExists(details, metadata) {
return this.create(details, Status.ALREADY_EXISTS, metadata, this.alreadyExists);
static alreadyExists(message, metadata) {
return this.create(message, Status.ALREADY_EXISTS, metadata, this.alreadyExists);
}
static permissionDenied(details, metadata) {
return this.create(details, Status.PERMISSION_DENIED, metadata, this.permissionDenied);
static permissionDenied(message, metadata) {
return this.create(message, Status.PERMISSION_DENIED, metadata, this.permissionDenied);
}
static resourceExhausted(details, metadata) {
return this.create(details, Status.RESOURCE_EXHAUSTED, metadata, this.resourceExhausted);
static resourceExhausted(message, metadata) {
return this.create(message, Status.RESOURCE_EXHAUSTED, metadata, this.resourceExhausted);
}
static failedPrecondition(details, metadata) {
return this.create(details, Status.FAILED_PRECONDITION, metadata, this.failedPrecondition);
static failedPrecondition(message, metadata) {
return this.create(message, Status.FAILED_PRECONDITION, metadata, this.failedPrecondition);
}
static aborted(details, metadata) {
return this.create(details, Status.ABORTED, metadata, this.aborted);
static aborted(message, metadata) {
return this.create(message, Status.ABORTED, metadata, this.aborted);
}
static outOfRange(details, metadata) {
return this.create(details, Status.OUT_OF_RANGE, metadata, this.outOfRange);
static outOfRange(message, metadata) {
return this.create(message, Status.OUT_OF_RANGE, metadata, this.outOfRange);
}
static unimplemented(details, metadata) {
return this.create(details, Status.UNIMPLEMENTED, metadata, this.unimplemented);
static unimplemented(message, metadata) {
return this.create(message, Status.UNIMPLEMENTED, metadata, this.unimplemented);
}
static internal(details, metadata) {
return this.create(details, Status.INTERNAL, metadata, this.internal);
static internal(message, metadata) {
return this.create(message, Status.INTERNAL, metadata, this.internal);
}
static unavailable(details, metadata) {
return this.create(details, Status.UNAVAILABLE, metadata, this.unavailable);
static unavailable(message, metadata) {
return this.create(message, Status.UNAVAILABLE, metadata, this.unavailable);
}
static dataLoss(details, metadata) {
return this.create(details, Status.DATA_LOSS, metadata, this.dataLoss);
static dataLoss(message, metadata) {
return this.create(message, Status.DATA_LOSS, metadata, this.dataLoss);
}
static unauthenticated(details, metadata) {
return this.create(details, Status.UNAUTHENTICATED, metadata, this.unauthenticated);
static unauthenticated(message, metadata) {
return this.create(message, Status.UNAUTHENTICATED, metadata, this.unauthenticated);
}
static create(details, code, metadata, ctor) {
const grpcBoom = new GrpcBoom(details, {
static create(message, code, metadata, ctor) {
const grpcBoom = new GrpcBoom(message, {
code,

@@ -134,5 +129,5 @@ metadata,

});
return grpcBoom.initialize(grpcBoom, code, details, metadata);
return grpcBoom.initialize(grpcBoom, code, message, metadata);
}
initialize(errorInstance, code, details, metadata) {
initialize(errorInstance, code, message, metadata) {
this.isBoom = true;

@@ -143,5 +138,5 @@ if (metadata) {

this.code = code;
if (details === undefined && errorInstance.details === undefined) {
if (message === undefined && errorInstance.message === undefined) {
this.reformat();
details = this.error;
message = this.error;
}

@@ -158,4 +153,4 @@ this.reformat();

}
if (this.details === undefined) {
this.details = GrpcBoom.fallbackMessage;
if (this.message === undefined) {
this.message = GrpcBoom.fallbackMessage;
}

@@ -162,0 +157,0 @@ }

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