Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mjhuff committed Nov 22, 2024
1 parent b9b7146 commit c8622ac
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion api-client/src/runs/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export interface UpdateErrorRecoveryPolicyRequest {
}

export type UpdateErrorRecoveryPolicyResponse = Record<string, never>
export type ErrorRecoveryPolicyResponse = ErrorRecoveryPolicy
export type ErrorRecoveryPolicyResponse = UpdateErrorRecoveryPolicyRequest

/**
* Current Run State Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,10 @@ export function useRecoveryCommands({

return updateErrorRecoveryPolicy(ignorePolicyRules, 'append')
.then(() => Promise.resolve())
.catch(() =>
Promise.reject(new Error('Failed to update recovery policy.'))
.catch((e: Error) =>
Promise.reject(
new Error(`Failed to update recovery policy: ${e.message}`)
)
)
} else {
void proceedToRouteAndStep(RECOVERY_MAP.ERROR_WHILE_RECOVERING.ROUTE)
Expand Down
4 changes: 2 additions & 2 deletions app/src/resources/runs/useUpdateRecoveryPolicyWithStrategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function useUpdateRecoveryPolicyWithStrategy(
strategy: UpdateErrorRecoveryPolicyWithStrategy['strategy']
) =>
getErrorRecoveryPolicy(host as HostConfig, runId).then(res => {
const existingPolicyRules = res.data.policyRules.map(rule => ({
const existingPolicyRules = res.data.data.policyRules.map(rule => ({
commandType: rule.matchCriteria.command.commandType,
errorType: rule.matchCriteria.command.error.errorType,
ifMatch: rule.ifMatch,
Expand All @@ -49,7 +49,7 @@ export function useUpdateRecoveryPolicyWithStrategy(
case 'append':
return [...existingPolicyRules, newPolicy]
default: {
console.error('Handled policy strategy, using append.')
console.error('Unhandled policy strategy, defaulting to append.')
return [...existingPolicyRules, newPolicy]
}
}
Expand Down

0 comments on commit c8622ac

Please sign in to comment.