Error Reporting Patterns
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Error reporting in a C library up vote 17 down vote favorite 4 I am looking for a robust way to report errors in a C library. Consider the simple example of a queue: struct queue *q = malloc(sizeof(*q)); if (NULL == q) { /* malloc failed. now what ? */ return NULL; /* maybe ? */ } Okay, so for that example returning NULL isn't otherwise valid so it makes sense to return it to signal an error. But void *get_data() { /* stuff */ /* Error detected. NULL is a valid return, now what ? */ /* stuff */ } What's more, once we signal an error, how to signal what is the error ? I have thought about it and don't have a satisfying solution. Using errno or some other global object isn't something I would like to do (perhaps the functions may be called from multiple threads etc). I thought of making the client supply some "status" object that can be inspected after the call, but that would make the API quite ugly. So what's your take on the subject ? How do you report errors in a clean way ? c design-patterns error-reporting share|improve this question edited Jul 1 '11 at 13:49 asked Jul 1 '11 at 13:42 nc3b 8,45812948 2 Another option is to make the return value have different meanings (or be just the return status) and pass objects (pointers) in parameters ... like, for example, system does –pmg Jul 1 '11 at 13:55 @pmg That too is a sensible approach. –nc3b Jul 1 '11 at 14:03 Honestly, I'm about to just make a error code bitmask and put all of the error fields for my bit reading/writing/etc in it's own struct that I check everytime it's ran. –MarcusJ Dec 12 '15 at 17:16 add a comment| 5 Answers 5 active oldest votes up vote 5 down vote accepted int get_data(void **ptr) If there are no obvious 'error returns', then maybe your output value should not be the return value. The error could either be an errno, some other custom detailed error value (*cough* HRESULT), just true/false for if the function succeeded, or some other bit of useful information (the length of the data, or -1 if error) share|improve this answer answered Jul 1 '11 at 15:14 Random832 17.5k22652 add a comment| up vot
free PDF. Contents Chapter Page of 287 Original Pages Text Pages Get This Book « Previous: 4 Building Leadership and Knowledge for Patient Safety Page 86 Share Cite Suggested Citation: "5 Error Reporting Systems." Institute of Medicine. To Err Is Human: Building a Safer Health System. Washington, DC: The National Academies Press, 2000. doi:10.17226/9728. × Save Cancel Page 865— Error Reporting SystemsAlthough the previous chapter talked about creating and disseminating new knowledge to prevent errors from ever http://stackoverflow.com/questions/6548749/error-reporting-in-a-c-library happening, this chapter looks at what happens after an error occurs and how to learn from errors and prevent their recurrence. One way to learn from errors is to establish a reporting system. Reporting systems have the potential to serve two important functions. They can hold providers accountable for performance or, alternatively, they can provide information that leads to improved https://www.nap.edu/read/9728/chapter/7 safety. Conceptually, these purposes are not incompatible, but in reality, they can prove difficult to satisfy simultaneously.Reporting systems whose primary purpose is to hold providers accountable are "mandatory reporting systems." Reporting focuses on errors associated with serious injuries or death. Most mandatory reporting systems are operated by state regulatory programs that have the authority to investigate specific cases and issue penalties or fines for wrong-doing. These systems serve three purposes. First, they provide the public with a minimum level of protection by assuring that the most serious errors are reported and investigated and appropriate follow-up action is taken. Second, they provide an incentive to health care organizations to improve patient safety in order to avoid the potential penalties and public exposure. Third, they require all health care organizations to make some level of investment in patient safety, thus creating a more level playing field. While safety experts recognize that Page 87 Share Cite Suggested Citation: "5 Error Reporting Systems." Institute of Medicine. To Err Is Human: Building a Safer Health System. Washington, DC: The National Acade
Annual Meeting 2009 SHM Annual Meeting 2008 SHM Annual Meeting 2007 Browse Browse by category Browse by keyword Resources Advanced Search Patterns of Error Reporting at a County Teaching Hospital Mark http://www.shmabstracts.com/abstract/patterns-of-error-reporting-at-a-county-teaching-hospital/ B. Reid1 1DHMC, Denver, CO Meeting: SHM Annual Meeting 2006 Abstract number: 45 Background: The Institute of Medicine's report, “To Err is Human,” identified the magnitude of the problem of medical errors in the United https://airbrake.io/blog/notifier/state-client-side-javascript-error-reporting States. Unfortunately, there is no universal system in the U.S. to define, categorize, and report medical errors. The University Hospital Consortium (UHC) is working in conjunction with a number of university hospitals to implement error reporting a web‐based error reporting system known as the Patient Safety Net (PSN). Although large amounts of data are being collected, no data has been published reflecting the patterns of use of this system by participating hospitals. The purpose of this study is to describe current patterns of usage of the PSN by employees at our hospital. Related Abstracts Hazardous to Your Health: A Novel Approach to Facilitating Resident error reporting patterns Error Reporting Bundling of Performance Measures on Admission and Discharge as a Hospitalist‐Specific Reporting Strategy for the 2007 Physician Quality Reporting Initiative. Who, What, Where, and When Patterns of Nurse‐Physician Communication and Agreement on the Plan of Care Method: Our hospital is a county teaching hospital in Denver, Colorado. During the calendar year 2004, our employees made 3,452 error reports using the PSN system. We evaluated the relationship between the job description of the reporter, the total number of errors reported, the error type, and the severity of harm. Summary of Results: Sixty‐four percent of the error reports from our hospital during 2004 occurred in inpatients and 27% occurred in outpatients. The most frequently reported errors were “near misses” accounting for 26% of all reports. Nurses, including RN's, LPN's, Nurses Aides and CRNA's, made 54% of the reports. Nine percent of errors occurring in inpatients resulted in harm ranging from temporary injury to death. Reports by doctors accounted for only 4% of the total number of error reports submitted but 14% of the errors in which a patient was harmed or died. Statement of Conclusions: The error reports submitted by physicians tended to reflect incidents in which the patient was harmed or died. A
difficult, error-prone and highly arcane practice. Browser differences, inline event handlers, frameworks and plugins without canonical error-handling attachment points, and callback hell have all contributed to the bruxism that plagues front-end devs. Airbrake exists to make devs lives easier, and not even the browser is exempt from our efforts. We've taken a long hard look at the state of tooling out there, and delivered tooling that we feel does just the right amount of heavy lifting while allowing developers to integrate the tool in ways that make sense for their environment. Easy things aren't easy For years, most browsers have supported the window.onerror event to varying degrees. Scripts run inline have fired this error, as have errors triggered by missing resources including scripts and images. Unfortunately, errors handled this way lack what is arguably the most important piece of information an error can carry, its stack trace. A number of error-handling tools hook into window.onerror and some even attempt to attach additional information to errors propagated this way. In general, we've taken a different approach to these problems, insisting that errors be handled closer to their source. What we do differently The Airbrake client-side error notifier takes a slightly different approach to dealing with errors from any of the tools that have come before it. Simple, convenient API Airbrake's client, like most JavaScript error-handlers provides a single API call to report an error. Ours looks something like this. JavaScript try { myProblematicFunction(); } catch(theError) { Airbrake.push({ error: theError }); } 123456 try {myProblematicFunction();} catch(theError) {Airbrake.push({ error: theError });} This construction appears over and over again in code where we care about errors. In fact, it occurs so often that we provide a convience wrapper for exactly this pattern. JavaScript Airbrake.try(myProblematicFunction); 12 Airbrake.try(myProblematicFunction); Asynchronous all the way down Page-load times and overall application responsiveness have been pressing topics amongst web developers for years. We wanted to create a tool that slott