I'm trying to display the custom message, Invalid voucher code. when applying an invalid voucher code.
I see the GlobalMessage voucher.applyVoucherSuccess defined in cart-voucher.effect.ts
and its actual text in the translations/en/cart.ts file
But how can I edit the error message when there's an invalid voucher code input?
Or if there's an easier way of doing it in spartacus?
Currently, there's no easy way or best to do in Spartacus until further notice. However, we do have a way to change the error message for invalid voucher code.
For example, look at the bad-request.handler.ts.
You can catch the specific error, which is VoucherOperationError. Using this error.type from the error response of {message: "coupon.invalid.code.provided", type: "VoucherOperationError"}, you can point to the translations key or your custom message using the raw property.
Related
I am developing a registration API using Laravel. One of the field which is date_of_birth, I planned to make it optional and with the type of date.
Therefore, I am writing this line of code inside my RegisterUserRequest file:
But the output is when I leave this field to empty or enter a correct date, it will pass the validation and execute my controller function as expected. But when I provide a wrong date, the validation is failed (which is expected) but the problem is the validation message wouldn't show out. The response received is empty.
Is anyone know what should I do in order to display error message for entering incorrect date format in this case?
Thank you.
I'm using the Youtube livechat.insert API (https://developers.google.com/youtube/v3/live/docs/liveChatMessages/insert), and occasionally get back the messageTextInvalid error. However the error description page doesn't give much of a hint as to what's wrong here (https://developers.google.com/youtube/v3/live/docs/errors#liveChatMessages_youtube.liveChatMessages.insert). I've ensured the messages being sent are <= 200 characters long, and do not have newlines in them. However a message like '(Discord) person: COMMENT : Wonderful!' returns this error that the text is invalid. Is there some information that I can find about what text is valid in the message? I also didn't find much information on the livechat message resource page (https://developers.google.com/youtube/v3/live/docs/liveChatMessages#resource)
I'm trying to figure out how to download a PDF from the BOE restful API.
I've been following the answer from ƘɌỈSƬƠƑ here:
SAP BI Open Doc URL for retrieving pdf
I was able to accomplish step 1 (getting the token).
But on the second step, it mentions using the documentID.
e.g.
/biprws/raylight/v1/documents/5690743/parameters
On the front end of BOE, if I click on the report, and choose Properties, it shows me that the "ID/CUID" is:
ID, CUID:746001, AdgNq_GsaqhOqnzc4gRN_Jg
Does that mean the "DocumentID" is 746001?
I'm not sure if I'm using the correct ID, because when I hit:
/biprws/raylight/v1/documents/746001/parameters
I get:
<error>
<error_code>100</error_code>
<message>Rule not respected (Argument 'reportIds' must not be null)</message>
</error>
You don't need to obtain prompt information (/parameters endpoint).
I think you are using the correct ID since the error is on the report. You obtain a 404 Not Found response status, if the document does not exist.
After a successful login, simply call /biprws/raylight/v1/documents/5690743 and add to your request an header with name Accept and value application/pdf. Of course the X-SAP-LogonToken should also be provided.
It will export the whole document. If you only need a specific report, you need to retrieve its ID first. Call the URI /biprws/raylight/v1/documents/5690743/reports with Accept header equals to application/json.
Choose one of the report, and get its ID (for example, in my case reportID equals 1234). Then you can export the report as a PDF by calling the URI: /biprws/raylight/v1/documents/5690743/reports/1234 with Accept header equals to application/pdf.
I am working on one server that resolve GraphQL queries. I used the graphql-kotlin library: https://github.com/ExpediaDotCom/graphql-kotlin.
I defined three resolve functions(could be viewed as three fields): getxxx(arguments...), getTarget(arguments...) and getSource(arguments...).
The problem is if one of my queried field failed, I will only get the 'errors' field. All other successful executed results(data) are dropped.
If I try to catch the exception for the failed field, then I will not get the 'error' field at last.
This is the image that had exception and dropped all fetched data:
The objective is returning both the successful fetched data in 'data' field and error message for failed field in 'errors' field.
I have checked this: How to return both error and data in a graphql resolver?
If I set a field that throw one error or exception intentionally, I will only get 'errors' field at last(Like the picture above).
In addition, many websites like this:https://itnext.io/the-definitive-guide-to-handling-graphql-errors-e0c58b52b5e1 suggest we should return partial result and error message, but in my case if I meet exception, only error message would be returned.
In our example application we have two top level queries
{
onlyCake(msg: "cake")
generateNumber
}
If I run this code this will return a random number and onlyCake returns the string <3. However if I modify the input of onlyCake to something that is not the string cake I will get an error. This is expected because the field onlyCake has a directive to implement this behavior.
https://github.com/ExpediaDotCom/graphql-kotlin/blob/2961b64d6e4cceb4034aec198d667e5f965decd2/example/src/main/kotlin/com/expedia/graphql/sample/directives/CakeOnlyDirectiveWiring.kt#L18-L19
The question is though, if I want to return the data still for generateNumber can I do that and have both errors and data in the response?
The answer is it's possible but not with the current schema. The issue is that our schema for onlyCake and generateNumber are both non-nullable fields. So as a client if I see that there is a data field I should expect to see both there otherwise I would have a parsing issue in my code. This is why we can't have this behaviour with the schema as is. If you want to implement this behaviour, the schema developer needs to decide where they can return null for some response and modify the errors field appropriately with a DataFetcherExceptionHandler
Or the other option is that we support the behaviour in graphql-java to return a DataFetcherResult<T> instead of just T from the kotlin functions. See the section Returning data and errors here: https://www.graphql-java.com/documentation/v13/execution/
I have created an issue to continue this discussion with other team members: https://github.com/ExpediaDotCom/graphql-kotlin/issues/244
I have an issue when I try to send an EDI document to a partner using AS2 (HTTPS). The transaction is being translated correctly and when it reaches EDIINT step I got the error:
Invalid input - URIString [EDIINT.000001.000003]
I already checked the URL provided by partner and it's working.
Something that is strange is that we can send the MDN when we receive any transaction from them, but when we try to send a transaction from our end, we got that error.
What's causing such errors and how can I fix it?
can you try encoding the URL string