Doubt about Ionic Creator with Firebase

Hello,

I am developing an application with Firebase and I came across a situation that I can not solve. If the user is connected to the internet the system works correctly, however if he loses the connection the application freezes and gives no error message. What I may be doing wrong? Follow the code:

 var auth = $firebaseAuth ();
 var userId = firebase.auth (). currentUser.uid;
 var ref = firebase.database (). ref ('users /' + userId) .child ('contas');
 var list = $firebaseArray (ref);

 list () {loaded (). then (function (x) {

         $ scope.itens = {};

         $ scope.itens = list;

         console.log (ok);

 }} catch (function (error) {

         console.error ("Error:", error);

 });

Can you give me a hint on how to show a user connection error message?

Tks