Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

[BUG] Poor error handling & made up error headers #318

Open
zdne opened this issue Jul 10, 2023 · 2 comments
Open

[BUG] Poor error handling & made up error headers #318

zdne opened this issue Jul 10, 2023 · 2 comments
Assignees

Comments

@zdne
Copy link
Member

zdne commented Jul 10, 2023

HTTP response error handling is not correct or helpful.

Expected Behavior

  1. errors are handled according to the API documentation / specification
  2. if there is a response body available it should be printed out / thrown in the error
  3. no made up headers should be present in the map

Current Behavior

Maps contain hallucinated headers x-error-code x-error-message but it do NOT contain error response bodies!

if (response.status !== 200) {
  const error = {
    object: 'error',
    status: response.status,
    code: response.headers['x-error-code']?.[0] ?? '',
    message: response.headers['x-error-message']?.[0] ?? '',
  };
  throw new std.unstable.MapError(error);
}

Possible Solution

  • at the very least report the response body, if available ❗
  • do not make up headers that do not exists

Ideal Solution

  • handle common HTTP error codes
  • respect the API documentation when it comes to error handling

Steps to Reproduce

Easiest way is to try to execute against any API unauthenticated. Most likely you will end up with the almost useless error:

ERROR: {
  "name": "PerformError",
  "errorResult": {
    "code": "",
    "message": "",
    "object": "error",
    "status": 401
  }
}

Your Environment

  • @superfaceai/cli/4.0.0-beta.5 darwin-x64 node-v18.13.0 (with @superfaceai/one-sdk@2.4.2, @superfaceai/parser@2.1.0)
  • macOS
  • OneSDK Beta0
  • Node 18.13
@kysely
Copy link
Member

kysely commented Jul 11, 2023

@zdne Can you please check again? This is related to #319 because the engine pulled up incorrect docs for the prompts. Thus it might have hallucinated some of the maps, too.

Also, this partly is AI issue.

@kysely kysely self-assigned this Jul 11, 2023
@zdne
Copy link
Member Author

zdne commented Jul 13, 2023

I will check it again today.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants