lablup / lablup/backend.ai

Standardized error codes

Open
#942 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
670
Forks
183
Avg merge
17h 7m
Merged PRs (30d)
358

Description

We have already some commonly defined error codes using [RFC-7807](https://www.rfc-editor.org/rfc/rfc7807)-style JSON response formats:

- https://github.com/lablup/backend.ai/blob/main/src/ai/backend/manager/api/exceptions.py\* Currently we are using `type`, `title` and our custom `data` field for structured error information.
- The `type` field is defined as URL-like strings, e.g., `"https://api.backend.ai/probs/quota-exceeded"`

Extra reference:

- https://dreamsh19.github.io/error/%EC%95%A0%ED%94%8C%EB%A6%AC%EC%BC%80%EC%9D%B4%EC%85%98-%EC%97%90%EB%9F%AC-%EC%BD%94%EB%93%9C-%EC%84%A4%EA%B3%84/
Let's extend and make explicit documentation about these errors.

- Introduce more RFC-7807 fields like `instance` and `status`.
- Include the full RFC-7807 object dumps in the console log as well.
- docs: Use the autodoc extension to automatically fill the exception code reference.
- Assign random-generated unique trace IDs to each exception and store the RFC-7807 object dumps in a database table keyed by the traced ID. (probably extending [the existing error_logs table](https://github.com/lablup/backend.ai/blob/main/src/ai/backend/manager/models/error_logs.py))
- Make a manager CLI command to fetch and dump the error log table as CSV, XML, etc. for on-site checkups and postmortems.
- Q. Should we introduce numeric error codes in addition to the `type`?

JIRA Issue: BA-229

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.