Skip to content

Commit

Permalink
fix: more helpful error messages (#826)
Browse files Browse the repository at this point in the history
Also remove unused types.
  • Loading branch information
achingbrain authored Apr 19, 2024
1 parent c798942 commit d5af0ca
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 35 deletions.
2 changes: 1 addition & 1 deletion src/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class DefaultFactory implements Factory<any> {
}

if (ctl == null) {
throw new Error('Unsupported type')
throw new Error(`Unsupported type "${type}" - configured types [${[...new Set([this.options.type, ...Object.keys(this.overrides)].filter(Boolean))].join(', ')}]`)
}

// Save the controller
Expand Down
30 changes: 0 additions & 30 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,36 +158,6 @@ export interface Node<API = unknown, Options = NodeOptions, Info extends Record<
cleanup(args?: CleanupArgs): Promise<void>
}

export interface InitOptions {
pass?: string
bits?: number
algorithm?: string
emptyRepo?: boolean
profiles?: string[]
allowNew?: boolean
privateKey?: string
}

export interface PreloadOptions {
enabled?: boolean
addresses?: string[]
}

export interface ExperimentalOptions {
sharding?: boolean
ipnsPubsub?: boolean
}

export interface CircuitRelayHopOptions {
enabled: boolean
active: boolean
}

export interface CircuitRelayOptions {
enabled: boolean
hop: CircuitRelayHopOptions
}

export interface NodeOptions<InitOptions = unknown, StartOptions = unknown> {
/**
* The type of controller
Expand Down
14 changes: 10 additions & 4 deletions src/kubo/daemon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,16 @@ export default class KuboDaemon implements KuboNode {
* this will be called automatically when the process is exited.
*/
async cleanup (): Promise<void> {
await fs.rm(this.repo, {
recursive: true,
force: true
})
try {
await fs.rm(this.repo, {
recursive: true,
force: true
})
} catch (err: any) {
if (err.code !== 'EPERM') {
throw err
}
}
}

async init (args?: KuboInitOptions): Promise<void> {
Expand Down

0 comments on commit d5af0ca

Please sign in to comment.