fix: the Kanban says the proof machine before a pull, folder downloads cut by the network wait for the next pass, expected refusals stay out of Sentry (DTF-WEB-16..1K, DTF-API-C)
All checks were successful
Build and deploy / Validate source (push) Successful in 6s
Build and deploy / Integration suite on a real stack (push) Successful in 7m37s
Build and deploy / Secret scan and release gate (push) Successful in 9s
Build and deploy / Publish images (push) Successful in 1m25s
All checks were successful
Build and deploy / Validate source (push) Successful in 6s
Build and deploy / Integration suite on a real stack (push) Successful in 7m37s
Build and deploy / Secret scan and release gate (push) Successful in 9s
Build and deploy / Publish images (push) Successful in 1m25s
- 19/1F: the board carries the approved proof's machine; the pull and the order's machine field keep to it and say why. - 17/1E: a network drop while a download or an answer arrives counts as unreachable/offline, warned first like the others. - 16: no folder picker (Safari): said in a line. - 1A, 1J/1K, 1D, 18: guidance and expected refusals (pull to another machine, someone already on the machine, e-mail in use, coupon) are not errors. - 1B: an empty file is refused on the page. - API-C: the Tiny's rate limit reaches Sentry only if it repeats. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -228,12 +228,14 @@ function freightWeight(fr){
|
||||
}
|
||||
// A download button: the arrow, then its label.
|
||||
function downloadButton(text,fn,className){const b=button(text,fn,className);b.prepend(svgIcon(IC.download,'i m'));return b;}
|
||||
async function api(path,body){
|
||||
async function api(path,body,options={}){
|
||||
// A fetch that never reached the server (no network) is marked offline.
|
||||
let r;
|
||||
try{r=await fetch('/api/operator'+path,{headers:{'Content-Type':'application/json'},...(body===undefined?{}:{method:'POST',body:JSON.stringify(body)})});}
|
||||
catch(e){e.offline=true;throw e;}
|
||||
const d=await r.json();
|
||||
// The network can also drop while the answer arrives (Sentry DTF-WEB-1E).
|
||||
let d;
|
||||
try{d=await r.json();}catch(e){if(e instanceof TypeError)e.offline=true;throw e;}
|
||||
if(!r.ok){
|
||||
// A validation error is a list: name its first field and what was wrong
|
||||
// instead of the bare status (Sentry DTF-WEB-E).
|
||||
@@ -242,7 +244,8 @@ async function api(path,body){
|
||||
const error=new Error(typeof d.detail==='string'?d.detail:
|
||||
'Confira os campos ('+r.status+')'+(first?': '+(field?field+', ':'')+first.msg:'.'));
|
||||
error.status=r.status;
|
||||
window.dtfObservability?.apiError?.(path,r.status,error.message,d.detail);
|
||||
// A status the caller expects and answers itself is not reported.
|
||||
if(!(options.expected||[]).includes(r.status))window.dtfObservability?.apiError?.(path,r.status,error.message,d.detail);
|
||||
throw error;
|
||||
}
|
||||
return d;
|
||||
@@ -403,6 +406,8 @@ function paintFolder(){
|
||||
$('badge-integrations').textContent=attention?'!':'';
|
||||
}
|
||||
async function chooseFolder(){
|
||||
// Safari and the phones have no folder picker (Sentry DTF-WEB-16).
|
||||
if(!('showDirectoryPicker' in window)){say('Este navegador não grava em pastas. Use o Chrome ou o Edge no computador da fábrica.');return;}
|
||||
let handle;
|
||||
try{handle=await window.showDirectoryPicker({id:'dtf-fila',mode:'readwrite'});}
|
||||
catch(e){if(e.name==='AbortError')return;throw e;}
|
||||
@@ -461,7 +466,13 @@ async function writeWhole(dir,name,source,watched=false){
|
||||
try{
|
||||
const out=await temp.createWritable();
|
||||
try{if(blob){await out.write(source);await out.close();}else await source.body.pipeTo(out);}
|
||||
catch(e){await out.abort().catch(()=>{});throw e;}
|
||||
catch(e){
|
||||
await out.abort().catch(()=>{});
|
||||
// A download the network cut halfway waits for the next pass, as one
|
||||
// that never started (Sentry DTF-WEB-17).
|
||||
if(!blob&&e instanceof TypeError)e.unreachable=true;
|
||||
throw e;
|
||||
}
|
||||
const size=(await temp.getFile()).size;
|
||||
if(!size||expected&&size!==expected)
|
||||
throw new IncompleteFile('O arquivo '+name+' chegou incompleto ('+fileSize(size)+(expected?' de '+fileSize(expected):'')+') e foi descartado.');
|
||||
|
||||
Reference in New Issue
Block a user