Skip to content

Commit

Permalink
Improve error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Jun 5, 2022
1 parent 8095ed4 commit e020bf0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { listCombinations } from './combination/list.js'
import { getConfig } from './config/main.js'
import { performDev } from './dev/main.js'
import { ErrorTypes } from './error/main.js'
import { mergeErrorCause } from './error/merge/main.js'
import { allowErrorTypes } from './error/types.js'
import { checkLimits } from './history/compare/limit.js'
import { getFromHistory, removeFromHistory } from './history/data/main.js'
Expand All @@ -31,7 +32,7 @@ export const run = async function (configFlags) {
checkLimits(programmaticResult)
return programmaticResult
} catch (error) {
throw allowErrorTypes(error, ErrorTypes)
throw allowErrorTypes(mergeErrorCause(error), ErrorTypes)
}
}

Expand All @@ -44,7 +45,7 @@ export const show = async function (configFlags) {
checkLimits(programmaticResult)
return programmaticResult
} catch (error) {
throw allowErrorTypes(error, ErrorTypes)
throw allowErrorTypes(mergeErrorCause(error), ErrorTypes)
}
}

Expand All @@ -58,7 +59,7 @@ export const remove = async function (configFlags) {
await removeFromHistory(targetRawResults, config)
return programmaticResult
} catch (error) {
throw allowErrorTypes(error, ErrorTypes)
throw allowErrorTypes(mergeErrorCause(error), ErrorTypes)
}
}

Expand All @@ -69,6 +70,6 @@ export const dev = async function (configFlags) {
const combinations = await listCombinations(config)
await performDev(combinations, config)
} catch (error) {
throw allowErrorTypes(error, ErrorTypes)
throw allowErrorTypes(mergeErrorCause(error), ErrorTypes)
}
}

0 comments on commit e020bf0

Please sign in to comment.