+ All Categories
Home > Documents > Ready Marjan Nikolovski Father, Dev, CEO/Emit Knowledge Down the rabbit hole Error handling examined...

Ready Marjan Nikolovski Father, Dev, CEO/Emit Knowledge Down the rabbit hole Error handling examined...

Date post: 04-Jan-2016
Category:
Upload: shannon-dixon
View: 212 times
Download: 0 times
Share this document with a friend
25
Ready Marjan Nikolovski Father, Dev, CEO/Emit Knowledge Down the rabbit hole Error handling examined try { } // Twitter: @m4rjann // Blog: emitknowledge.com/research- labs
Transcript
Page 1: Ready Marjan Nikolovski Father, Dev, CEO/Emit Knowledge Down the rabbit hole Error handling examined try { } // Twitter: @m4rjann // Blog: emitknowledge.com/research-labs.

Ready

Marjan NikolovskiFather, Dev, CEO/Emit Knowledge

Down the rabbit holeError handling examined

try {

}

// Twitter: @m4rjann// Blog: emitknowledge.com/research-labs

Page 2: Ready Marjan Nikolovski Father, Dev, CEO/Emit Knowledge Down the rabbit hole Error handling examined try { } // Twitter: @m4rjann // Blog: emitknowledge.com/research-labs.

Ready

Page 3: Ready Marjan Nikolovski Father, Dev, CEO/Emit Knowledge Down the rabbit hole Error handling examined try { } // Twitter: @m4rjann // Blog: emitknowledge.com/research-labs.

Ready

Agenda

• Error theory;• Error types;• Handling error per type;• Responsible sides;• Error handling strategies;• Error handling for business logic;• Error handling for client;• Error handling for web applications;• Log analytics;

Page 4: Ready Marjan Nikolovski Father, Dev, CEO/Emit Knowledge Down the rabbit hole Error handling examined try { } // Twitter: @m4rjann // Blog: emitknowledge.com/research-labs.

Ready

ERROR IS AN ANY INTERUPTION THAT STOPS THE SYSTEM TO EXECUTE A BUSINESS CONTEXT

Page 5: Ready Marjan Nikolovski Father, Dev, CEO/Emit Knowledge Down the rabbit hole Error handling examined try { } // Twitter: @m4rjann // Blog: emitknowledge.com/research-labs.

Ready

A system must have a good strategy when it comes to error handling

Most of the code in a solution is trying to handle different types of errors and exceptions

It is easy to specify and write code to make the system operable. Hard times come when trying to predict what can go wrong

Page 6: Ready Marjan Nikolovski Father, Dev, CEO/Emit Knowledge Down the rabbit hole Error handling examined try { } // Twitter: @m4rjann // Blog: emitknowledge.com/research-labs.

Ready

Bugs, issues we can’t predict nor control. Ex: Stackoverflow, Nullpointer...

Error types

using System;

class Program{ static void Main() {

User appUser = DomainServices.User.GetByUsername(@“marjann”);

Console.WriteLine(appUser.Email); }}

Page 7: Ready Marjan Nikolovski Father, Dev, CEO/Emit Knowledge Down the rabbit hole Error handling examined try { } // Twitter: @m4rjann // Blog: emitknowledge.com/research-labs.

Ready

Error from invalid input.Ex: We expect integer value, the user enters some random characters...

Error types

using System;

class Program{ static void Main() {

var userIdInput = Console.ReadLine();int id = int.Parse(userIdInput);Console.WriteLine(id);

}}

Page 8: Ready Marjan Nikolovski Father, Dev, CEO/Emit Knowledge Down the rabbit hole Error handling examined try { } // Twitter: @m4rjann // Blog: emitknowledge.com/research-labs.

Ready

Infrastructural problems.Ex: Missing write permissions on server, full disk, DB not available...

Error types

using System;

class Program{ static void Main() {

var user = UserRepository.GetByUsername(@”marjann”);Console.WriteLine(user.Email);

}}

Page 9: Ready Marjan Nikolovski Father, Dev, CEO/Emit Knowledge Down the rabbit hole Error handling examined try { } // Twitter: @m4rjann // Blog: emitknowledge.com/research-labs.

Ready

Bugs are system problems that we can’t handle unless we apply a patch.

So what types of errors we can handle?

Invalid data entry is a system problem that we can handle proactively.

If we have infrastructural problems, the system should be able to notify the system administrators.

Page 10: Ready Marjan Nikolovski Father, Dev, CEO/Emit Knowledge Down the rabbit hole Error handling examined try { } // Twitter: @m4rjann // Blog: emitknowledge.com/research-labs.

Ready

End clients who are using the system.

Responsible sides

System administrators.

Software developers.

Page 11: Ready Marjan Nikolovski Father, Dev, CEO/Emit Knowledge Down the rabbit hole Error handling examined try { } // Twitter: @m4rjann // Blog: emitknowledge.com/research-labs.

Ready

Software developers.

Who should handle the bugs?

Page 12: Ready Marjan Nikolovski Father, Dev, CEO/Emit Knowledge Down the rabbit hole Error handling examined try { } // Twitter: @m4rjann // Blog: emitknowledge.com/research-labs.

Ready

Global – architectural decision on system level.

Error handling strategies

Local-contextual – handling errors in a process/method/action.

Page 13: Ready Marjan Nikolovski Father, Dev, CEO/Emit Knowledge Down the rabbit hole Error handling examined try { } // Twitter: @m4rjann // Blog: emitknowledge.com/research-labs.

Ready

КЛИЕНТ/КОРИСНИЧКИ ИНТЕРФЕЈС

БИЗНИС ЛОГИКА

ПОДАТОЧНО РЕПОЗИТОРИ

АПИ СЕРВИСИ

ЕКСТЕРНИ СЕРВИСИ

СПРАВУВАЊЕ СО ГРЕШКИ

ERROR HANDLING

Web/Mobile/Device REST API SERVICES

BUSINESS LOGIC

DATA REPOSITORY EXTERNAL SERVICES

Page 14: Ready Marjan Nikolovski Father, Dev, CEO/Emit Knowledge Down the rabbit hole Error handling examined try { } // Twitter: @m4rjann // Blog: emitknowledge.com/research-labs.

Ready

Global perspective of the system.

GLOBAL STRATEGY

Centralized error handling.

We want detailed error instead of wrapped exception.

We want execution details.

We want unified error messages.

Page 15: Ready Marjan Nikolovski Father, Dev, CEO/Emit Knowledge Down the rabbit hole Error handling examined try { } // Twitter: @m4rjann // Blog: emitknowledge.com/research-labs.

Ready

GLOBAL STRATEGY

Internally, a system should not hide the exceptions.Ex: User.IsExistingUsername(“marjann”) -> DbConnetionException != false

Externally, a system should always be transparent and should support unified error information when an error occurs.Ex: Invalid username, Username is not valid!?

Page 16: Ready Marjan Nikolovski Father, Dev, CEO/Emit Knowledge Down the rabbit hole Error handling examined try { } // Twitter: @m4rjann // Blog: emitknowledge.com/research-labs.

Ready

Say hello to the local context.

What if we can retry?

Use local context as an exception to the rule!

We can’t predict and handle all of the errors, but we must keep the system alive.

Exception to the rule: If it does not work fake it!

Page 17: Ready Marjan Nikolovski Father, Dev, CEO/Emit Knowledge Down the rabbit hole Error handling examined try { } // Twitter: @m4rjann // Blog: emitknowledge.com/research-labs.

Ready

Unification of errors, codes and groups.

Error handling for business logic

Information about an error(Error Info) against Exceptions.

Enrich an error with data for logging aspect.

Page 18: Ready Marjan Nikolovski Father, Dev, CEO/Emit Knowledge Down the rabbit hole Error handling examined try { } // Twitter: @m4rjann // Blog: emitknowledge.com/research-labs.

Ready

Demo

Page 19: Ready Marjan Nikolovski Father, Dev, CEO/Emit Knowledge Down the rabbit hole Error handling examined try { } // Twitter: @m4rjann // Blog: emitknowledge.com/research-labs.

Ready

Be transparent and show enough information to the end user.

Error handling for client

Page 20: Ready Marjan Nikolovski Father, Dev, CEO/Emit Knowledge Down the rabbit hole Error handling examined try { } // Twitter: @m4rjann // Blog: emitknowledge.com/research-labs.

Ready

Demo

Page 21: Ready Marjan Nikolovski Father, Dev, CEO/Emit Knowledge Down the rabbit hole Error handling examined try { } // Twitter: @m4rjann // Blog: emitknowledge.com/research-labs.

Ready

Error message localization.

Error handling for web applications

Transferring error information back to the app.

Page 22: Ready Marjan Nikolovski Father, Dev, CEO/Emit Knowledge Down the rabbit hole Error handling examined try { } // Twitter: @m4rjann // Blog: emitknowledge.com/research-labs.

Ready

Demo

Page 23: Ready Marjan Nikolovski Father, Dev, CEO/Emit Knowledge Down the rabbit hole Error handling examined try { } // Twitter: @m4rjann // Blog: emitknowledge.com/research-labs.

Ready

Who, What, How, Where, When?

Log analytics

PROM – tool for process mining.

We should be able to answer:- How our system is used?- Where our system perform slow?- Parameters of execution?- Patterns of execution?

Page 24: Ready Marjan Nikolovski Father, Dev, CEO/Emit Knowledge Down the rabbit hole Error handling examined try { } // Twitter: @m4rjann // Blog: emitknowledge.com/research-labs.

Ready

Page 25: Ready Marjan Nikolovski Father, Dev, CEO/Emit Knowledge Down the rabbit hole Error handling examined try { } // Twitter: @m4rjann // Blog: emitknowledge.com/research-labs.

Ready

catch(PPTException up){

}

Logger.Log(“QUESTIONS?”, up);throw up;


Recommended