In the case of a security error, the error object will contain a PERMISSION_DENIED code: http://jsfiddle.net/katowulf/ZG9CY/
For instance, if I run the following against a protected path:
new Firebase(URL).set({ hello: 'world' }, function(error) {
$('pre').text( 'done: '+ JSON.stringify(error) );
});
I get the following:
done: {"code":"PERMISSION_DENIED"}
There is a doc somewhere talking about the error codes, when I find it I'll add it to this post. (nope, it's about authentication errors)