Skip to content

Conversation

bas4r
Copy link

@bas4r bas4r commented Aug 30, 2025

No description provided.

Copy link

@dolcalmi dolcalmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 12 to 17
export class DealerQuotesAppError extends DealerQuoteServiceError {
level = ErrorLevel.Critical
}
export class DealerQuotesServerError extends DealerQuoteServiceError {
level = ErrorLevel.Critical
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this does not mean nothing.. can you create more specific errors?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you stated on call, i re-named the dealer-quote service name to just quotes, now you can see the new and more verbose error pattern matching in core/api/src/domain/quotes/errors.ts and in core/api/src/services/quotes/quotes.ts as such:

const handleDealerErrors = (err: Error | string | unknown) => {
  const errMsg = parseErrorMessageFromUnknown(err)

  const match = (knownErrDetail: RegExp): boolean => knownErrDetail.test(errMsg)

  switch (true) {
    case match(KnownDealerErrorDetails.NoConnection):
      return new NoConnectionToQuotesError(errMsg)

    case match(KnownDealerErrorDetails.QuotesExchangePrice):
      return new QuotesExchangePriceError(errMsg)

    case match(KnownDealerErrorDetails.QuotesLedgerError):
      return new QuotesLedgerError(errMsg)

    case match(KnownDealerErrorDetails.QuotesEntityError):
      return new QuotesEntityError(errMsg)

    case match(KnownDealerErrorDetails.QuotesAlreadyAcceptedError):
      return new QuotesAlreadyAcceptedError(errMsg)

    case match(KnownDealerErrorDetails.QuotesExpiredError):
      return new QuotesExpiredError(errMsg)

    case match(KnownDealerErrorDetails.QuotesCouldNotParseIdError):
      return new QuotesCouldNotParseIdError(errMsg)

    case match(KnownDealerErrorDetails.QuotesServer):
      return new QuotesServerError(errMsg)

    default:
      return new UnknownQuotesServiceError(errMsg)
  }
}

export const KnownDealerErrorDetails = {
  NoConnection: /No connection established/,
  QuotesExchangePrice:
    /(?:StalePrice: last update was at|No price data available|OrderBook:)/,
  QuotesLedgerError: /Sqlx/,
  QuotesEntityError: /EntityError/,
  QuotesAlreadyAcceptedError: /already accepted/,
  QuotesExpiredError: /Quote has expired/,
  QuotesCouldNotParseIdError: /CouldNotParseIncomingUuid/,
  QuotesServer: /QuotesServerError/,
} as const

@bas4r bas4r force-pushed the stablesats-quotes branch from 82c5831 to 7ea52e2 Compare September 2, 2025 14:09
@bas4r bas4r changed the title [WIP] - Stablesats quotes feat: add stablesats quotes graphql endpoints Sep 3, 2025
@bas4r bas4r force-pushed the stablesats-quotes branch 3 times, most recently from 8241198 to ed018e8 Compare September 9, 2025 19:21
@bas4r bas4r force-pushed the stablesats-quotes branch from ed018e8 to 200b7f6 Compare September 9, 2025 19:28

let result

switch (quoteType) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic is a symptom that the query is not designed properly. please make a proposal before implement it

Comment on lines +11 to +14
walletId: {
type: GT.NonNull(WalletId),
description: "Wallet id of the requesting wallet",
},

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's authorized on wallet level and without providing walletId, it automatically returns error missing walletId.

Comment on lines +19 to +25
export class QuotesEntityError extends QuotesServiceError {
level = ErrorLevel.Critical
}

export class QuotesLedgerError extends QuotesServiceError {
level = ErrorLevel.Critical
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remember this is the domain of the core, not stablesats

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Comment on lines 9 to 11
if (!quoteId || typeof quoteId !== "string") {
return new Error("Invalid quote ID provided")
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to create a checkedToQuoteId in domain also please dont use generic errors in app layer

@bas4r bas4r force-pushed the stablesats-quotes branch from 50c097c to f1e6c85 Compare October 2, 2025 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants