Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure Renovate #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended"
]
}
15 changes: 11 additions & 4 deletions src/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export async function api<T = any>({
const sanitizedQuery = pickBy(query, (v) => v);
const queryString = Object.keys(sanitizedQuery).length ? `?${qs.stringify(sanitizedQuery)}` : '';

const url = `${config.apiUrl}${path}${queryString}`;
const url = !path.startsWith('https') ? `${config.apiUrl}${path}${queryString}` : `${path}${queryString}`;

const headers = {
'Content-Type': 'application/json',
Expand Down Expand Up @@ -89,9 +89,16 @@ export async function api<T = any>({
});

let body;
try {
body = responseType === 'json' ? await response.json() : response.body;
} catch (e) {}
if (responseType === 'json') {
const rawBody = await response.text();
try {
body = responseType === 'json' ? JSON.parse(rawBody) : response.body;
} catch (e) {
body = rawBody;
}
} else {
body = response.body;
}

if (API_DEBUG) {
console.log(
Expand Down
2 changes: 1 addition & 1 deletion src/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export type DeployResponse = {
squidName?: string;
versionName?: string;
deploymentUrl?: string;
failed: 'NO' | 'UNEXPECTED' | 'PERMISSIONS' | 'REQUIREMENTS';
failed: 'NO' | 'UNEXPECTED' | 'PERMISSIONS' | 'REQUIREMENTS' | 'SOURCE_FILES_BUILD_FAILED';
logs: { severity: 'debug' | 'warn' | 'info' | 'error'; message: string }[];
createdAt: string;
};
Expand Down
7 changes: 6 additions & 1 deletion src/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ export abstract class CliCommand extends Command {
return this.error('The API is currently unavailable. Please try again later');
default:
return this.error(
'Unknown server error. Please check that your are using the latest version of the Squid CLI. If the error persists please open an issue at https://github.com/subsquid/subsquid-cli and report to t.me/HydraDevs',
[
`Unknown network error occurred`,
`==================`,
`Status: ${status}`,
`Body:\n${JSON.stringify(body)}`,
].join('\n'),
);
}
}
Expand Down