-
Notifications
You must be signed in to change notification settings - Fork 6
feat: add stablesats quotes graphql endpoints #205
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use https://www.conventionalcommits.org/
export class DealerQuotesAppError extends DealerQuoteServiceError { | ||
level = ErrorLevel.Critical | ||
} | ||
export class DealerQuotesServerError extends DealerQuoteServiceError { | ||
level = ErrorLevel.Critical | ||
} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
82c5831
to
7ea52e2
Compare
8241198
to
ed018e8
Compare
ed018e8
to
200b7f6
Compare
|
||
let result | ||
|
||
switch (quoteType) { |
There was a problem hiding this comment.
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
walletId: { | ||
type: GT.NonNull(WalletId), | ||
description: "Wallet id of the requesting wallet", | ||
}, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
export class QuotesEntityError extends QuotesServiceError { | ||
level = ErrorLevel.Critical | ||
} | ||
|
||
export class QuotesLedgerError extends QuotesServiceError { | ||
level = ErrorLevel.Critical | ||
} |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
if (!quoteId || typeof quoteId !== "string") { | ||
return new Error("Invalid quote ID provided") | ||
} |
There was a problem hiding this comment.
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
50c097c
to
f1e6c85
Compare
No description provided.