We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Now, function public static async find(query: RoomQueryFilter): Promise` , when we cannot get room, it will throw new Error.
source code as follows:
public static async find(query: RoomQueryFilter): Promise<Room> { log.verbose('Room', 'find({ topic: %s })', query.topic) const roomList = await Room.findAll(query) if (!roomList || roomList.length < 1) { throw new Error('no room found') } const room = roomList[0] await room.ready() return room }
I thought it should return null when we cannot find the room instead of throw error.
The text was updated successfully, but these errors were encountered:
Then I look up into Class Contact, I think
Class Contact
public static async find(query: ContactQueryFilter): Promise<Contact>
it should return null too when we cannot find the contact instead of throw error
Sorry, something went wrong.
I agree. PR is welcome.
wechaty#291 change throw error to return null
9fd6ca1
throw error
return null
#291 change throw error to return null (#292)
92800c2
* #291 change throw error to return null * add jsDoc
291 (#318)
26c57e6
* #291 change throw error to return null * add jsDoc * fix room null error
No branches or pull requests
Now, function public static async find(query: RoomQueryFilter): Promise` , when we cannot get room, it will throw new Error.
source code as follows:
I thought it should return null when we cannot find the room instead of throw error.
The text was updated successfully, but these errors were encountered: