UNPKG

@etsoo/appscript

Version:

Applications shared TypeScript framework

24 lines (23 loc) 555 B
import { ApiError } from "@etsoo/restclient"; /** * Action result */ export class ActionResult { /** * Create a result from error * @returns Action result interface */ static create(error) { // If the error is ApiError, hold the status const status = error instanceof ApiError ? error.status : undefined; // Result const result = { status, ok: false, type: error.name, title: error.message }; // Return return result; } }