-
Notifications
You must be signed in to change notification settings - Fork 61
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
handle (panic) on missing payment chosen platform #2646
handle (panic) on missing payment chosen platform #2646
Conversation
fb26018
to
23194ed
Compare
…rm' of github.com:golemfactory/yagna into staszek/yagna-2639/handle-missing-payment-chosen-platform
agent/provider/src/market/negotiator/builtin/demand_validation.rs
Outdated
Show resolved
Hide resolved
agent/provider/src/market/negotiator/builtin/demand_validation.rs
Outdated
Show resolved
Hide resolved
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.
Few nitpicks.
core/payment/src/api/allocations.rs
Outdated
@@ -49,7 +48,7 @@ async fn create_allocation( | |||
let payment_platform = allocation | |||
.payment_platform | |||
.clone() | |||
.unwrap_or_else(|| DEFAULT_PAYMENT_PLATFORM.to_string()); | |||
.expect("payment platform not 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.
It panics on None
. Please convert it to error response.
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.
Do we even still need it after adding new Negotiator?
core/payment/src/models/agreement.rs
Outdated
@@ -39,7 +38,7 @@ impl WriteObj { | |||
let payment_platform = demand_properties | |||
.pointer("/golem/com/payment/chosen-platform") | |||
.as_typed(Value::as_str) | |||
.unwrap_or(DEFAULT_PAYMENT_PLATFORM) | |||
.expect("Demand property golem.com.payment.chosen-platform does not exist") |
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 before, it panics, so it should be either converted to Error or removed if unnecessary (because of new Negotiator).
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.
I added some diffs to make it follow some common conventions like try_new
when new
returns Result
, and I moved creation of DbError
from constructor into the DAO
.
Co-authored-by: pwalski <4924911+pwalski@users.noreply.github.com>
Co-authored-by: pwalski <4924911+pwalski@users.noreply.github.com>
Co-authored-by: pwalski <4924911+pwalski@users.noreply.github.com>
Co-authored-by: pwalski <4924911+pwalski@users.noreply.github.com>
Co-authored-by: pwalski <4924911+pwalski@users.noreply.github.com>
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 squash commits (or cleanup history and I will approve again (but squash merge will be fine)).
No description provided.