> For the complete documentation index, see [llms.txt](https://soufatn.gitbook.io/rxjs-book/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://soufatn.gitbook.io/rxjs-book/summary/observer/observer_instance_methods/checked.md).

# checked

Checks access to the observer for grammar violations. This includes checking for multiple `onError` or `onCompleted` calls, as well as reentrancy in any of the observer methods.

If a violation is detected, an Error is thrown from the offending observer method call.

### Returns

*(Observer)*: An observer that checks callbacks invocations against the observer grammar and, if the checks pass, forwards those to the specified observer.

### [Example](http://jsbin.com/vikam/2/edit?js,console)

```javascript
var observer = Rx.Observer.create(
  x => console.log(`onNext: ${x}`),
  e => console.log(`onError: ${e}`),
  () => console.log('onCompleted'));

var checked = observer.checked();

checked.onNext(42);
// => onNext: 42

checked.onCompleted();
// => onCompleted

// Throws Error('Observer completed')
checked.onNext(42);
```

### Example
