erlef / rebar3_hex

Rebar3 Hex library
Apache License 2.0
101 stars 49 forks source link

docs crashes if publishing to non-existant version #280

Closed tsloughter closed 2 years ago

tsloughter commented 2 years ago

Publishing docs for a version of a package that doesn't exist results in a crash instead of an error message:

{"init terminating in do_boot",{badarg,[{io,format,[<0.64.0>,"===> Unknown error : ~ts~n",[{publish,{error,#{<<"message">>=><<"Page not found">>,<<"status">>=>404}}}]],[]},{rebar3_hex_error,format_error,1,[{file,"/home/tristan/.cache/rebar3/plugins/rebar3_hex/src/rebar3_hex_error.erl"},{line,24}]},{rebar3,handle_error,2,[{file,"/home/runner/work/rebar3/rebar3/src/rebar3.erl"},{line,347}]},{init,start_em,1,[]},{init,do_boot,3,[]}]}}
init terminating in do_boot ({badarg,[{io,format,[<0.64.0>,[_],[_]],[]},{rebar3_hex_error,format_error,1,[{_},{_}]},{rebar3,handle_error,2,[{_},{_}]},{init,start_em,1,[]},{init,do_boot,3,[]}]})
starbelly commented 2 years ago

This is sort of fixed in master now as part of #272 ... but there's a part that's still "meh".

Currently (master) this will now result in :

===> Failed to publish docs for truecoat - 0.4.660 : Page not found

We could check to see if we get "Page not found" message back from hex, and if so suggest a few things :

===> Failed to publish docs for truecoat - 0.4.660 : the  0.4.660 package could not be found, be sure your publishing docs for the same version as the package you intend to the docs to go along with. 

Of course, we're making an assumption there. Thoughts?

Edit:

What would be better is to send a PR up to hexpm to return a better error message IMO.

ferd commented 2 years ago

Failed to publish docs for truecoat - 0.4.660 : the truecoat package at version 0.4.6660 could not be found would likely contain all required information to double-check things, without being misleading if the issue is say, Hex being down.