Fix in layer_definition and in tests

The error will be thrown with ‘layer level’. For example:
layer.on('error', function(e) {
            console.log(e);
          })