Skip to content

[Feature]: graphqlのエラーハンドリング #271

@YukiOnishi1129

Description

@YukiOnishi1129

Summary


フロント側のエラーの形
全部、errors[0].messageに紐づいてくる

message: "Unexpected error value: { code: 6, message: \"Already existed favorite article in selected

BFF側の実装

  • rejectでcodeとか返したら、全部messageに入れられる?
client.createMultiFavoriteArticlesForUploadArticle(req, (err, res) => {
        if (err) {
          reject({
            code: err?.code || 500,
            message: err?.details || 'something went wrong',
          });
          return;
        }

エラーの型はGraphQLFormattedErrorらしい

Objective

Tasks

Other

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions