Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor failureFunction args #27

Merged
merged 2 commits into from
Nov 18, 2024
Merged

Refactor failureFunction args #27

merged 2 commits into from
Nov 18, 2024

Conversation

fahreddinozcan
Copy link
Collaborator

Currently the failureFunction interface is as below. To recieve the failHeaders, you also need to pass the args before. With this PR, you can now destructure the args and use only what you need.

export const { POST } = serve<string>(
  async (context) => { ... },
  {
    failureFunction: async (
      context,      // context during failure
      failStatus,   // failure status
      failResponse, // failure message
      failHeaders   // failure headers
    ) => {
      // handle the failure
    }
  }
);

This is now turned into

export const { POST } = serve<string>(async (context) => {
  ...
}, {
  failureFunction: async ({ context, failResponse }) => {
    //handle the failure
  },
})

Copy link

linear bot commented Nov 18, 2024

@CahidArda CahidArda merged commit 794532a into main Nov 18, 2024
17 checks passed
@CahidArda CahidArda deleted the DX-1428 branch November 18, 2024 14:24
@CahidArda CahidArda restored the DX-1428 branch November 18, 2024 14:24
@CahidArda CahidArda deleted the DX-1428 branch November 18, 2024 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants