File tree Expand file tree Collapse file tree 5 files changed +15
-5
lines changed Expand file tree Collapse file tree 5 files changed +15
-5
lines changed Original file line number Diff line number Diff line change 11import { isAsyncFunction } from '@plexusjs/utils'
22import { PlexusInstance , instance } from './instance/instance'
3- import { PlexusError , handlePlexusError } from './error '
3+ import { handlePlexusError } from '@plexusjs/utils '
44type ErrorHandler = ( error : any ) => unknown
55
66export interface PlexusActionHooks {
Original file line number Diff line number Diff line change 1+ import { handlePlexusError } from '@plexusjs/utils'
12import type { PlexusCollectionInstance } from '../collection/collection'
23import type { PlexusComputedStateInstance } from '../computed'
3- import { handlePlexusError } from '../error'
44import type { PlexusEventInstance } from '../event'
55import type { PlexusStateInstance } from '../state'
66import { PlexusInstance , instance } from './instance'
Original file line number Diff line number Diff line change 1- import { PlexusInstance } from './instance/instance'
2-
3- type PlexusErrorOptions = { code : string ; source : string ; stack : string }
1+ type PlexusErrorOptions = {
2+ code : string
3+ source : string
4+ stack : string
5+ type ?: 'general' | 'api' | 'action'
6+ } & Record < 'type' , string >
47
58export class PlexusError extends Error {
69 public name = 'PlexusError'
710 public error = true
11+ type = 'general'
812 constructor (
913 message : string ,
1014 public options ?: Partial < PlexusErrorOptions >
1115 ) {
1216 super ( message )
17+ if ( options ) {
18+ this . options = options
19+ this . type = options . type || 'general'
20+ }
1321 }
1422 // custom error format for logging and debugging
1523 toString ( ) {
Original file line number Diff line number Diff line change 1+ export * from './error'
Original file line number Diff line number Diff line change 11export * from './shared'
2+ export * from './client'
23
34export * from './types'
You can’t perform that action at this time.
0 commit comments