Skip to content

Commit

Permalink
fix(record): emits an error instead of _$onError
Browse files Browse the repository at this point in the history
The record handler is not an emitter, and all errors due to
incorrect state should go through the `client._$onError` callback

Fixes deepstreamIO#305
  • Loading branch information
yasserf committed Apr 8, 2017
1 parent 9809b46 commit 8daba7b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/record/record-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ RecordHandler.prototype._onRecordError = function (recordName, error) {
*/
RecordHandler.prototype._onDestroyPending = function (recordName) {
if (!this._records[recordName]) {
this.emit('error', `Record '${recordName}' does not exists`)
this._client._$onError(C.TOPIC.RECORD, 'Record attempted to be destroyed but does not exists', recordName)
return
}
const onMessage = this._records[recordName]._$onMessage.bind(this._records[recordName])
Expand Down

0 comments on commit 8daba7b

Please sign in to comment.