default metric name after error

This commit is contained in:
Sander Hautvast 2018-05-17 17:09:53 +02:00
parent 138418cada
commit 5049459bbc

View file

@ -7,12 +7,17 @@ public class MethodInvocation {
private MethodInvocation(String name) { private MethodInvocation(String name) {
t0 = System.nanoTime(); t0 = System.nanoTime();
this.name = name; if (name != null) {
this.name = name;
} else {
this.name = "<UNKNOWN_BECAUSE_OF_ERROR>";
}
} }
public static MethodInvocation start(String name) { public static MethodInvocation start(String name) {
return new MethodInvocation(name); return new MethodInvocation(name);
} }
public static void stop(MethodInvocation methodInvocation) { public static void stop(MethodInvocation methodInvocation) {
methodInvocation.stop(); methodInvocation.stop();
} }