Returning null is the expected behavior if the requested context is not available or if the canvas is already assigned to another type of context:
Returns null if the given context identifier is not supported, if the canvas has already been initialized with another type of context (for example, it tries to get the "2d" context after receiving the "webgl" context).
There are special cases where an exception may be related to proxy (ibid) scripts:
Throws an InvalidStateError exception if setContext() or the transferControlToProxy() methods are used.
In addition to this, although the browser may support a certain type of context, there is no guarantee that an object can be created if system resources, such as memory, are low, in which case null will be returned.
Below is an overview of what will be returned in different scenarios.

Thus, if you are not using proxies (which are not currently fully supported), you do not need to use try-catch with getContext() .
Tip. In the future, the canvas will receive the property probablySupportsContext() , which can be used before getContext() . This will do these tests and return false if the conditions are not met (supported context, already used with a different type of context, low resources, etc.):
var supported = canvas . probablySupportsContext(contextId [, ... ] )
Returns false if the call to getContext() with the same arguments definitely returns null, and true otherwise.
Update I just wanted to dwell in detail on a special case - for specific extensions for suppliers it is theoretically possible to get an exception created depending on this particular extension and how it defines its behavior. But they should not be considered part of the standard and, since in most cases they are experimental, risk and non-standard behavior are implied.