Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

sentry / @nestjs/microservices   js

Repository URL to install this package:

Version: 7.0.10 

/ exceptions / rpc-exception.js

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
class RpcException extends Error {
    constructor(error) {
        super();
        this.error = error;
        this.initMessage();
    }
    initMessage() {
        if (shared_utils_1.isString(this.error)) {
            this.message = this.error;
        }
        else if (shared_utils_1.isObject(this.error) &&
            shared_utils_1.isString(this.error.message)) {
            this.message = this.error.message;
        }
        else if (this.constructor) {
            this.message = this.constructor.name
                .match(/[A-Z][a-z]+|[0-9]+/g)
                .join(' ');
        }
    }
    getError() {
        return this.error;
    }
}
exports.RpcException = RpcException;