UNPKG

@supernovaio/cli

Version:

Supernova.io Command Line Interface

67 lines (65 loc) 2.47 kB
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="5fd0eafb-6347-5ea5-9e64-049c2e4820a4")}catch(e){}}(); import * as Sentry from "@sentry/node"; import { isAxiosError } from "axios"; import { BaseCommand } from "./base-command.js"; import { NotAuthorizedError } from "./not-authorized.error.js"; import { CLIError } from "@oclif/core/errors"; export class SentryCommand extends BaseCommand { constructor(argv, config) { super(argv, config); } async catch(error) { if (!(error instanceof CLIError)) { this.logToStderr(error.message); } if (error.oclif) throw error; if (error instanceof NotAuthorizedError) throw error; if (isAxiosError(error)) { const captureMetadata = { code: error.code, message: error.message, response: { status: error.response?.status, data: error.response?.data, }, }; Sentry.captureMessage(`Axios error metadata: ${JSON.stringify(captureMetadata)}`); } Sentry.captureException(error); this.logToStderr(`Something went wrong. Please try again later.`); } async finally() { } async parse(options, argv) { Sentry.addBreadcrumb({ category: "command", data: { commandName: this.id, }, level: "debug", message: "Starting command parse", }); const parsed = await super.parse(options, argv); const span = Sentry.getActiveSpan(); if (span) { span.setAttributes({ args: Object.keys(parsed.args), designSystemId: parsed.flags.designSystemId, flags: Object.keys(parsed.flags), workspaceId: parsed.flags.workspaceId, }); } Sentry.addBreadcrumb({ category: "command", data: { result: "success", }, level: "debug", message: "Command parse completed", }); return parsed; } } //# sourceMappingURL=sentry-command.js.map //# debugId=5fd0eafb-6347-5ea5-9e64-049c2e4820a4