Skip to content

Commit ff1c945

Browse files
committed
fix: Correct error handling response in API route to return success instead of failure
1 parent d899963 commit ff1c945

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

apps/meteor/app/api/server/v1/misc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ API.v1.addRoute(
535535
if (settings.get('Log_Level') === '2') {
536536
Meteor._debug(`Exception while invoking method ${method}`, err);
537537
}
538-
return API.v1.failure(mountResult({ id, error: err }));
538+
return API.v1.success(mountResult({ id, error: err }));
539539
}
540540
},
541541
},

apps/meteor/tests/end-to-end/api/methods.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3111,10 +3111,9 @@ describe('Meteor.methods', () => {
31113111
room = (
31123112
await createRoom({
31133113
type: 'd',
3114-
name: `direct.test.${Date.now()}-${Math.random()}`,
31153114
username: guestUser.username,
31163115
})
3117-
).body.channel;
3116+
).body.room;
31183117
createdRooms.push(room);
31193118
});
31203119
after(() =>
@@ -3141,9 +3140,8 @@ describe('Meteor.methods', () => {
31413140
.expect('Content-Type', 'application/json')
31423141
.expect(200)
31433142
.expect((res) => {
3144-
expect(res.body).to.have.property('success', false);
3145-
expect(res.body).to.have.property('error').that.is.a('string');
3146-
expect(res.body.error).to.equal('error-cant-invite-for-direct-room');
3143+
expect(res.body).to.have.property('message').that.is.an('string');
3144+
expect(res.body.message).to.include('error-cant-invite-for-direct-room');
31473145
})
31483146
.end(done);
31493147
});

0 commit comments

Comments
 (0)