Skip to content
This repository has been archived by the owner on Sep 8, 2023. It is now read-only.

api: Fix verbose logs and ThreadsAPIError messages #279

Merged
merged 1 commit into from
Jul 24, 2023
Merged
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
20 changes: 10 additions & 10 deletions threads-api/src/threads-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -775,9 +775,9 @@ export class ThreadsAPI {
}
if (data?.status !== 'ok') {
if (this.verbose) {
console.log('[USER FEED] Failed to fetch', data);
console.log('[USER PROFILE] Failed to fetch', data);
}
throw new ThreadsAPIError('Failed to fetch user feed: ' + JSON.stringify(data), data);
throw new ThreadsAPIError('Failed to fetch user profile: ' + JSON.stringify(data), data);
}
return data;
};
Expand Down Expand Up @@ -818,9 +818,9 @@ export class ThreadsAPI {
}
if (data?.status !== 'ok') {
if (this.verbose) {
console.log('[USER FEED] Failed to fetch', data);
console.log('[USER THREADS] Failed to fetch', data);
}
throw new ThreadsAPIError('Failed to fetch user feed: ' + JSON.stringify(data), data);
throw new ThreadsAPIError('Failed to fetch user threads: ' + JSON.stringify(data), data);
}
return data;
};
Expand Down Expand Up @@ -902,9 +902,9 @@ export class ThreadsAPI {
}
if (data?.status !== 'ok') {
if (this.verbose) {
console.log('[USER FEED] Failed to fetch', data);
console.log('[USER REPLIES] Failed to fetch', data);
}
throw new ThreadsAPIError('Failed to fetch user feed: ' + JSON.stringify(data), data);
throw new ThreadsAPIError('Failed to fetch user replies: ' + JSON.stringify(data), data);
}
return data;
};
Expand Down Expand Up @@ -968,9 +968,9 @@ export class ThreadsAPI {
}
if (data?.status !== 'ok') {
if (this.verbose) {
console.log('[USER FOLLOWING] Failed to fetch', data);
console.log('[USER FOLLOWINGS] Failed to fetch', data);
}
throw new ThreadsAPIError('Failed to fetch user following: ' + JSON.stringify(data), data);
throw new ThreadsAPIError('Failed to fetch user followings: ' + JSON.stringify(data), data);
}
return data;
};
Expand Down Expand Up @@ -1366,9 +1366,9 @@ export class ThreadsAPI {
}
if (data?.status !== 'ok') {
if (this.verbose) {
console.log('[NOTIFICATIONS] Failed to fetch', data);
console.log('[USER SEARCH] Failed to fetch', data);
}
throw new ThreadsAPIError('Failed to fetch notifications: ' + JSON.stringify(data), data);
throw new ThreadsAPIError('Failed to fetch user search results: ' + JSON.stringify(data), data);
}
return data;
};
Expand Down