Skip to content

Commit

Permalink
sqlite: error if sqlite isn't enabled but search() is called
Browse files Browse the repository at this point in the history
When we assert that something can't possibly happen, we better
error out rather than jugging on with no error ;)
  • Loading branch information
brunnre8 committed Nov 1, 2022
1 parent 0fa2035 commit cebc6d0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions server/plugins/messageStorage/sqlite.ts
Expand Up @@ -213,10 +213,12 @@ class SqliteMessageStorage implements ISqliteMessageStorage {
}) as Promise<Message[]>;
}

search(query: SearchQuery): Promise<SearchResponse | []> {
search(query: SearchQuery): Promise<SearchResponse> {
if (!this.isEnabled) {
// this should never be hit as messageProvider is checked in client.search()
return Promise.resolve([]);
return Promise.reject(
"search called but sqlite provider not enabled. This is a programming error"
);
}

// Using the '@' character to escape '%' and '_' in patterns.
Expand Down

0 comments on commit cebc6d0

Please sign in to comment.