Skip to content

Commit

Permalink
Error handle
Browse files Browse the repository at this point in the history
  • Loading branch information
inventionpro committed Aug 27, 2024
1 parent 6b8c957 commit d28002b
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ function PT(path, callback, method = 'GET', body = '') {
e = await e.text();
} else {
e = await e.json();
if (e.errors) {
alert(e.errors[0].detail);
return;
}
}
callback(e)
})
Expand All @@ -17,14 +21,14 @@ function formatBytes(bytes, decimals = 2) {
const i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + sizes[i];
}
function __PRI__edr(er,tr) {
if (er == 0) {
return '';
} else {
return er+tr+' '
}
}
function time_gud(time) {
function __PRI__edr(er,tr) {
if (er == 0) {
return '';
} else {
return er+tr+' '
}
}
return `${__PRI__edr(Math.floor(time / 31536000),'Y')}${__PRI__edr(Math.floor(time % 31536000 / 604800),'W')}${__PRI__edr(Math.floor(time / 86400) % 7,'d')}${__PRI__edr(Math.floor(time / 3600) % 24,'h')}${__PRI__edr(Math.floor(time / 60) % 60,'m')}${__PRI__edr(time % 60,'s')}`
}
function file_type(mime, name) {
Expand Down

0 comments on commit d28002b

Please sign in to comment.