File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -52,7 +52,9 @@ module.exports = async (files = [], options = {}) => {
5252 } ) ;
5353
5454 if ( res . error )
55- throw ( console . error ( 'There was a error creating your bin' ) , res . error ) ;
55+ throw new Error (
56+ 'There was a error creating your bin: ' + res . error . message ,
57+ ) ;
5658
5759 const Bin = await get ( res . data . key ) ;
5860 if ( ! Bin ) throw new Error ( 'There was a error getting your bin' ) ;
Original file line number Diff line number Diff line change @@ -31,9 +31,8 @@ module.exports = async (key, options = {}) => {
3131
3232 const binData = await fetch ( `https://sourceb.in/api/bins/${ key } ` ) ;
3333 if ( binData . error )
34- throw (
35- ( console . error ( 'There was a error in fetching bin data' ) ,
36- binData . error )
34+ throw new Error (
35+ 'There was a error in fetching bin data: ' + binData . error . message ,
3736 ) ;
3837
3938 if ( options . fetchContent ) {
@@ -46,12 +45,8 @@ module.exports = async (key, options = {}) => {
4645 ) ;
4746
4847 if ( content . error )
49- throw (
50- ( console . error (
51- 'There was a error in fetching bin content for file ' +
52- i ,
53- ) ,
54- content . error )
48+ throw new Error (
49+ `There was a error in fetching bin content for file ${ i } : ${ content . error . message } ` ,
5550 ) ;
5651
5752 binData . data . files [ i ] = {
Original file line number Diff line number Diff line change @@ -20,5 +20,5 @@ module.exports = async (url, options = {}) => {
2020 } ,
2121 } )
2222 . then ( ( res ) => ( { data : res . body } ) )
23- . catch ( ( res ) => ( { error : res } ) ) ;
23+ . catch ( ( error ) => ( { error } ) ) ;
2424} ;
You can’t perform that action at this time.
0 commit comments