2013-03-20 5 views
0

를 얻을 수 0.7.4 (도 0.7.1)는 일부 오류가 get 핸들러 함수의 실행 중에 발생하는 경우, 아무것도없는 것을 알 수 있었다 콘솔에 인쇄됩니다.sammy.js 핸들러 숨어 오류

<html> 
    <head> 
     ... 
     <script src="/path/to/jquery-1.5.2.min.js"></script> 
     <script src="/path/to/sammy-0.7.4.min.js"></script> 
     ... 
    </head> 
    <body> 
     <script> 
      $(document).ready(function() { 
       var sammy = Sammy(function() { 
        this.get('#someAnchor', function() { 
         // this function doesn't exist 
         notExistingFunction(); 
        }); 
       }); 
       sammy.run(); 

       // this should lead to execution of above handler 
       window.location.hash = '#someAnchor'; 
      }); 
     </script> 
     ... 
    </body> 
</html> 

이 정말 페이지의 문제 해결을 복잡하게 사람이이 경험 않은 : 이름 notExistingFunction와 함수가 존재하지 불구하고 다음 코드 아무것도 예를 들어

는 콘솔에 인쇄됩니다? 이 예상되는 동작이나 버그입니까? 이 문제를 해결할 수있는 방법이 있습니까? 이 somewhy raise_errors 플래그가 오류보고를 관리 기본적으로 false로 설정 한 것으로 밝혀졌습니다 sammy.js의 소스를 검사 한 후 - 아웃 켜지고 사전

답변

1

에서 많은 생각보다 쉬울 수

감사합니다.

그래서,에 위의 코드 일부를 수정 : 좋은 오류를 보여주는

<html> 
    <head>...</head> 
    <body> 
     <script> 
      ... 
      sammy.raise_errors = true; 
      sammy.run(); 
      ... 
     </script> 
    </body> 
</html> 

시작됩니다.