Skip to content

Commit

Permalink
Merge pull request #181 from snow-actions/fix/error-handling
Browse files Browse the repository at this point in the history
Fix error handling
  • Loading branch information
SnowCait committed May 1, 2022
2 parents 6cf3252 + 7074fe7 commit e8abc0e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions dist/index.js
Expand Up @@ -15485,7 +15485,7 @@ const twitter_1 = __importDefault(__webpack_require__(50));
const util_1 = __webpack_require__(669);
function tweet(status, mediaIds = []) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise(resolve => {
return new Promise((resolve, reject) => {
if (!(0, util_1.isString)(status)) {
throw new Error('status not a string');
}
Expand All @@ -15507,9 +15507,9 @@ function tweet(status, mediaIds = []) {
: {
status
};
client.post('statuses/update', parameters, (error, data, response) => {
if (error) {
throw error;
client.post('statuses/update', parameters, (errors, data, response) => {
if (errors) {
reject(errors);
}
resolve(response.body);
});
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions src/tweet.ts
Expand Up @@ -5,7 +5,7 @@ export async function tweet(
status: string,
mediaIds: string[] = []
): Promise<string> {
return new Promise(resolve => {
return new Promise((resolve, reject) => {
if (!isString(status)) {
throw new Error('status not a string')
}
Expand All @@ -30,9 +30,9 @@ export async function tweet(
: {
status
}
client.post('statuses/update', parameters, (error, data, response) => {
if (error) {
throw error
client.post('statuses/update', parameters, (errors, data, response) => {
if (errors) {
reject(errors)
}

resolve(response.body)
Expand Down

0 comments on commit e8abc0e

Please sign in to comment.