Raising Error when uploading a file

In one of my projects I have an entity where the user can upload .gef files. These files are then processed and parsed, and entities are created. However, if the .gef file does not contain complete data the parsing fails and the .gef cannot be uploaded. The user however is only presented with a red cross and Error next to it. Therefore I tried to add a nicer UserError to explain to the user why the .gef cannot be uploaded. My code is as follows (I capture the parsing error with the except clause on line 124):

When I try to upload an incomplete .gef I am now presented with the message in the UserError as wanted but the message is displayed with Error: Error: in front.

I was wondering what I am doing wrong causing the Error: to be displayed twice.

Hi @Rutger , thanks for raising this issue. Can you share a bit bigger screenshot? Where is this text located? Is this a file being uploaded through a FileField or a File Entity?

Hi @matthijs, the text is located when trying to upload a file through a File Entity. See screenshot below.

Thanks! I have been able to reproduce this, this is a mistake from our side. I will add it to our internal issue tracker such that it will be fixed.

1 Like