-
Notifications
You must be signed in to change notification settings - Fork 18
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
feat(sipi): Improve error message if XSL file not found #1590
Conversation
@flavens Could you check if this branch gives you a better error message? |
I think it is better, however, I would have search for a long time it was the BEOL server file at the wrong place! I still need more experience with errors to get a better instinct :) |
@flavens Hmm, that's not what it's supposed to say. Can you give me a simple way to make this error happen? |
It's supposed to say something like "Unable to get XSL transformation file XYZ from Sipi"... |
You can checkout the master branch of Knora-app. Run on your terminal: Then go to http://0.0.0.0:4200/system/users after log in (you can use the root user profile) and try to Add a user as system admin: See error in the console. |
|
|
you run |
I did that and got an error message that told me to run The error message says "error But |
Can confirm that the whole command
[wait for yarn to complete installation]
EDIT: It has to be |
@musicEnfanthen Thanks, I just figured out the same thing at the same time. :) |
@flavens I did what you described, and I can see in the console that the request is empty ( In any case, I don't think that can have anything to do with the issue about an XSL file that doesn't exist. The request to create an admin user uses the admin API, which doesn't do anything with XSL templates. XSL templates are used to transform text markup in a resource. |
@benjamingeer ah! an idea: I spotted this error before the release of knora-app. In the master branch, we have the newest knora-api-js-lib. To reproduce the error, you could try with knora-api-js-lib v0.1.1, knora-api v11.0.0 and place the BEOL server file in another folder. |
@flavens OK, I've actually just added an e2e test for this, which confirms that if you request a resource with an XSL transformation, and the XSL file doesn't exist, you get an HTTP 500 error with the message "Unable to get XSL transformation file". I don't know how to check this manually using the BEOL data, but I guess you would have to request a BEOL resource. @tobiasschweizer can you help? |
responseStr <- doSipiRequest(request) | ||
} yield SipiGetTextFileResponse(responseStr) | ||
|
||
sipiResponseTry.recover { | ||
case badRequestException: BadRequestException => throw SipiException(s"Unable to get XSL transformation file $xsltFileUrl from Sipi: ${badRequestException.message}") |
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.
sipiGetXsltTransformationRequestV2
is called in two cases: for XSLT used by StandoffResponderV2
to turn XML into HTML and for XSLT used the TEI transformer in ResourcesResponderV2
. So I guess testing it with the TEI route is fine.
However, SipiGetTextFileRequest
is as the message sent to SipiConnector
that then internally calls sipiGetXsltTransformationRequestV2
seems strange to me. Shouldn't either the message be more specific or the method more generic?
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.
In the future, Knora might require other text files from Sipi than XSL transformations and then the error message thrown by sipiGetXsltTransformationRequestV2
might be misleading.
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.
Quite true, I'll fix that.
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.
Done in 080dd44.
@tobiasschweizer @flavens Is this better now? |
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.
Ok, I think like this it is much better.
Is there a way to tell the client why Knora tried to get a text file from Sipi? There are two cases at the moment : one in the TEI route and one in the standoff route.
What would you like it to say? |
It would be great if the message would tell who sent the message to |
You'd like it to say, "Requested by StandoffResponderV2"? |
Yes, but only if the message was sent by |
I could add it to the message. |
That would great. It is like a stack trace. |
OK, now the error message is "Unable to get file http://0.0.0.0:1024/0801/missing.xsl from Sipi as requested by org.knora.webapi.responders.v2.StandoffResponderV2: Sipi responded with HTTP status code 404: Not Found". |
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.
That's great, thanks!
@tobiasschweizer @flavens Thanks to both of you for your help with this. |
This PR improves the error returned if Knora requests a nonexistent XSL transformation file from Sipi.
Resolves #1580.