mirror of
https://github.com/msgpack/msgpack-python.git
synced 2026-02-07 02:09:59 +00:00
java: Improved DefaultTemplate.java. It allows displaying details of exception messages
This commit is contained in:
parent
8e3ea8d26c
commit
85e90aa81e
1 changed files with 5 additions and 5 deletions
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// MessagePack for Java
|
||||
//
|
||||
// Copyright (C) 2009-2010 FURUHASHI Sadayuki
|
||||
// Copyright (C) 2009-2011 FURUHASHI Sadayuki
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
|
@ -43,14 +43,14 @@ public class DefaultTemplate implements Template {
|
|||
public void pack(Packer pk, Object target) throws IOException {
|
||||
if(messagePackable) {
|
||||
if(target == null) {
|
||||
throw new MessageTypeException("target is null.");
|
||||
throw new MessageTypeException("target is null: " + target.getClass().getName());
|
||||
}
|
||||
((MessagePackable)target).messagePack(pk);
|
||||
return;
|
||||
}
|
||||
Template tmpl = TemplateRegistry.tryLookup(lookupType);
|
||||
if(tmpl == this || tmpl == null) {
|
||||
throw new MessageTypeException();
|
||||
throw new MessageTypeException("Template lookup fail: " + lookupType.getClass().getName());
|
||||
}
|
||||
tmpl.pack(pk, target);
|
||||
}
|
||||
|
|
@ -69,7 +69,7 @@ public class DefaultTemplate implements Template {
|
|||
}
|
||||
Template tmpl = TemplateRegistry.tryLookup(lookupType);
|
||||
if(tmpl == this || tmpl == null) {
|
||||
throw new MessageTypeException();
|
||||
throw new MessageTypeException("Template lookup fail: " + lookupType.getClass().getName());
|
||||
}
|
||||
return tmpl.unpack(pac, to);
|
||||
}
|
||||
|
|
@ -88,7 +88,7 @@ public class DefaultTemplate implements Template {
|
|||
}
|
||||
Template tmpl = TemplateRegistry.tryLookup(lookupType);
|
||||
if(tmpl == this || tmpl == null) {
|
||||
throw new MessageTypeException();
|
||||
throw new MessageTypeException("Template lookup fail: " + lookupType.getClass().getName());
|
||||
}
|
||||
return tmpl.convert(from, to);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue