Skip navigation
Use este identificador para citar ou linkar para este item: https://repositorio.ufpe.br/handle/123456789/34149

Compartilhe esta página

Título: A study of JavaScript error handling
Autor(es): SANTOS, Luana Martins dos
Palavras-chave: Engenharia de software; Tratamento de erros
Data do documento: 14-Fev-2019
Editor: Universidade Federal de Pernambuco
Abstract: JavaScript is in widespread use for both Web-based and Standalone software development. A large number of production quality, robust software systems are currently built using it. Because of its popularity, JavaScript has been the subject of a several empirical studies in the last few years. Previous research has analyzed uses of the eval function, how callbacks are employed, and other aspects of the language. In this work, we contribute to the existing body of knowledge by studying how developers employ error handling mechanisms in JavaScript systems. JavaScript provides two different mechanisms for handling errors, try-catch blocks and callback functions. These mechanisms are employed along with a number of abstractions that have not been previously studied in the context of error handling, namely: promises, events, and asynchronous functions. In addition, we evaluated the usage of global event handlers, which is applicable for scenarios where an error occurred and no handler was found. We analyzed 192 popular JavaScript repositories from Github, comprising more than 60 thousand files and 11 million lines of code. We also classified them as Web-based or Standalone, depending on Node.js framework usage. We analyzed how the error handling mechanisms of the language are employed, what error handling strategies are typically used, and how Web-based and Standalone systems differ regarding the error handling. Errors impact differently in Web-based and Standalone systems. Users may not concern about the errors in Web-based as it generally occurs in the console. Standalone systems deal differently with errors, once the system finds an error, it crashes and does not allow any further operation. Our findings indicate that pure callbacks are the predominant error handling mechanism in JavaScript systems (64.500 callback functions in our dataset), although try-catch blocks are also frequently used (51.200 try-catch blocks). We found 22.44% of the try-catch blocks are empty, 15.48% of the error handlers ignore the error parameter (from catch clause). In callback functions, 8.66% ignore any error parameter it receives, and 5.54% reassign an error parameter. Web-based systems have a greater number of try-catch blocks than callback functions for error handling compared to standalone systems. Web-based systems have a greater number of handlers that ignore error parameters than standalone systems. In summary, our analysis shows that error-handling strategies are generally simplistic, mostly ignoring the error (11.5%) or leaving it empty (8.22%).
Descrição: LIMA FILHO, Fernando José Castor de, também é conhecido(a) em citações bibliográficas por: CASTOR FILHO, Fernando
URI: https://repositorio.ufpe.br/handle/123456789/34149
Aparece nas coleções:Dissertações de Mestrado - Ciência da Computação

Arquivos associados a este item:
Arquivo Descrição TamanhoFormato 
DISSERTAÇÃO Luana Martins dos Santos.pdf943,74 kBAdobe PDFThumbnail
Visualizar/Abrir


Este arquivo é protegido por direitos autorais



Este item está licenciada sob uma Licença Creative Commons Creative Commons