mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-07 12:57:47 +00:00
[now-static-build] Update error message to mention project settings (#3926)
This PR improves the error message to make it actionable. The docs will be updated in https://github.com/zeit/docs/pull/1661 with even more detail.
This commit is contained in:
@@ -89,39 +89,54 @@ async function filePost (body, digest) {
|
||||
'x-now-size': body.length,
|
||||
};
|
||||
|
||||
const resp = await fetchWithAuth('/v2/now/files', {
|
||||
const url = '/v2/now/files';
|
||||
|
||||
const resp = await fetchWithAuth(url, {
|
||||
method: 'POST',
|
||||
headers,
|
||||
body,
|
||||
});
|
||||
|
||||
const json = await resp.json();
|
||||
|
||||
if (json.error) {
|
||||
console.log('headers', resp.headers);
|
||||
throw new Error(json.error.message);
|
||||
const { status, statusText, headers } = resp;
|
||||
const { message } = json.error;
|
||||
console.log('Fetch Error', { url , status, statusText, headers, digest });
|
||||
throw new Error(message);
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
async function deploymentPost (payload) {
|
||||
const resp = await fetchWithAuth('/v6/now/deployments?forceNew=1', {
|
||||
const url = '/v6/now/deployments?forceNew=1';
|
||||
const resp = await fetchWithAuth(url, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
|
||||
console.log(`fetch status: ${resp.status} ${resp.statusText}`);
|
||||
const json = await resp.json();
|
||||
|
||||
if (json.error) {
|
||||
console.log('headers', resp.headers);
|
||||
throw new Error(json.error.message);
|
||||
const { status, statusText, headers } = resp;
|
||||
const { message } = json.error;
|
||||
console.log('Fetch Error', { url , status, statusText, headers });
|
||||
throw new Error(message);
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
async function deploymentGet (deploymentId) {
|
||||
const resp = await fetchWithAuth(`/v3/now/deployments/${deploymentId}`);
|
||||
return await resp.json();
|
||||
const url = `/v3/now/deployments/${deploymentId}`;
|
||||
const resp = await fetchWithAuth(url);
|
||||
const json = await resp.json();
|
||||
if (json.error) {
|
||||
const { status, statusText, headers } = resp;
|
||||
const { message } = json.error;
|
||||
console.log('Fetch Error', { url , status, statusText, headers });
|
||||
throw new Error(message);
|
||||
}
|
||||
return json
|
||||
}
|
||||
|
||||
let token;
|
||||
|
||||
Reference in New Issue
Block a user