Opened 13 years ago

Closed 11 years ago

#361 closed defect (fixed)

MediaGoblin should show an appropriate, helpful error message when uploading unsupported media type

Reported by: Christopher Allan Webber Owned by:
Priority: minor Milestone:
Component: programming Keywords: more-info
Cc: Parent Tickets:

Description (last modified by Christopher Allan Webber)

Currently if you try to upload a file for a media type that isn't
handled / isn't currently registered, you get the 500 error page
and in the traceback get:


    File '/home/cwebber/devel/mediagoblin/mediagoblin/', line 171 in __call__
      response = controller(request)
    File '/home/cwebber/devel/mediagoblin/mediagoblin/', line 50 in new_controller_func
      return controller(request, *args, **kwargs)
    File '/home/cwebber/devel/mediagoblin/mediagoblin/submit/', line 53 in submit_start
      media_type, media_manager = get_media_type_and_manager(filename)
    TypeError: 'NoneType' object is not iterable

This isn't helpful; we should give an error page yes, but one with
useful information that says "sorry, we couldn't recognize that
media type, it might not be supported or not enabled for this
site", or something.

This is a semi-bitesized task.

Change History (8)

comment:1 by Christopher Allan Webber, 13 years ago

It would be great if that could include an error page, and also if
the function raising the error raised a more appropriate error.

I believe there's some other exception defined in that module meant
to be raised, it should raise that and catch it in the view.

comment:2 by Elrond, 13 years ago

Can you please give a simple way to reproduce this backtrace?
Like "submit a .XYZ while having media\_types = ... in the config"?
That would help in actually creating a correct error page.

comment:3 by Will Kahn-Greene, 12 years ago

The original url for this bug was .

comment:4 by Elrond, 12 years ago

Milestone: 0.2.1

comment:5 by Elrond, 12 years ago

Keywords: more-info added

We need a proper, failing test case!

comment:6 by Christopher Allan Webber, 12 years ago

Description: modified (diff)

I could add a failing unit test.

I guess it should return the response code "415 Unsupported Media Type"... that's exactly the purpose this http status code was built for :)

comment:7 by jenifferjones, 12 years ago


Last edited 12 years ago by Will Kahn-Greene (previous) (diff)

comment:8 by Christopher Allan Webber, 11 years ago

Resolution: fixed
Status: acceptedclosed

I think we do provide such an error message now, so I'm closing this out.

Note: See TracTickets for help on using tickets.