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

jsonProtocol should report errors as nicely as before #18876

Closed
SomiDivian opened this issue Apr 22, 2023 · 2 comments
Closed

jsonProtocol should report errors as nicely as before #18876

SomiDivian opened this issue Apr 22, 2023 · 2 comments
Assignees
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/client Issue for team Client. topic: jsonProtocol topic: previewFeatures Issue touches on an preview feature flag
Milestone

Comments

@SomiDivian
Copy link

SomiDivian commented Apr 22, 2023

As you can see, the jsonProtocol preview feature doesn't report errors as good as before.

model Wallet {
  id String @id @default(auto()) @map("_id") @db.ObjectId
  config WalletConfig[]
}

... TransferMethod enums

type TransferMethod {
  type     TransferMethodType
  token    String
  country  TransferMethodCountry
  currency TransferMethodCurrency
  email    String?
  status   TransferMethodStatus?
  meta     Json?
}

enum ConfigType {
  typeone
}

model WalletConfig {
  id String @id @default(auto()) @map("_id") @db.ObjectId

  type    ConfigType       @default(typeone)
  email   String
  token   String
  methods TransferMethod[]
  status  String?

  wallet   Wallet? @relation(fields: [walletId], references: [id])
  walletId String  @db.ObjectId
}

Errors without jsonProtocol

  • Wrong method.country
Argument country: Provided value 'country1' of type String on prisma.updateOneWalletConfig is not a TransferMethodCountry.
→ Possible values: TransferMethodCountry.Co1, ...
  • Wrong method.currency
Argument currency: Provided value 'USD' of type String on prisma.updateOneWalletConfig is not a TransferMethodCurrency.
→ Possible values: TransferMethodCurrency.Cu1, ...

Errors with jsonProtocol

→ 406 await prisma.walletConfig.update({
        where: {
          id: config_id
        },
        data: {
          type: "typeone", // same if we don't update this
          methods: {
            push: {
              type: "CORRECT_TYPE_FOR_SURE",
              country: "wrong_country", // this
              currency: "WRONG_CURRENCY", // or this is wrong
              token: "...",
              email: "...",
              meta: {
                metadata
              },
              status: "CORRECT_STATUS_FOR_SURE"
            },
      +     type: TransferMethodType
          }
        }
      })

Argument `type` is missing.
...
@jkomyno jkomyno added kind/improvement An improvement to existing feature and code. team/client Issue for team Client. labels Apr 24, 2023
@jkomyno jkomyno changed the title jsonProtocol doesn't report errors well jsonProtocol should report errors as nicely as before Apr 24, 2023
@jkomyno jkomyno added topic: previewFeatures Issue touches on an preview feature flag topic: jsonProtocol labels Apr 24, 2023
@janpio janpio added bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. kind/bug A reported bug. and removed kind/improvement An improvement to existing feature and code. labels Apr 25, 2023
@SevInf SevInf self-assigned this Apr 26, 2023
@SevInf SevInf added bug/2-confirmed Bug has been reproduced and confirmed. and removed bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. labels Apr 26, 2023
@SevInf
Copy link
Contributor

SevInf commented Apr 26, 2023

Note: this is fixed by #18515

@SevInf
Copy link
Contributor

SevInf commented Apr 26, 2023

Fix will be published as a part of Prisma 4.14.0.

@SevInf SevInf closed this as completed Apr 26, 2023
@janpio janpio added this to the 4.14.0 milestone Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/client Issue for team Client. topic: jsonProtocol topic: previewFeatures Issue touches on an preview feature flag
Projects
None yet
Development

No branches or pull requests

4 participants