Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id E3697200BBF for ; Mon, 14 Nov 2016 10:26:15 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id E215A160B27; Mon, 14 Nov 2016 09:26:15 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id D7B30160B20 for ; Mon, 14 Nov 2016 10:26:14 +0100 (CET) Received: (qmail 49074 invoked by uid 500); 14 Nov 2016 09:26:14 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 48691 invoked by uid 99); 14 Nov 2016 09:26:13 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Nov 2016 09:26:13 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 908C8ED22B; Mon, 14 Nov 2016 09:26:13 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ptupitsyn@apache.org To: commits@ignite.apache.org Date: Mon, 14 Nov 2016 09:26:20 -0000 Message-Id: <50df00dbcc514a589711c81bb25d9dbc@git.apache.org> In-Reply-To: <0f79fc8f6b1b434e94699a3b9e78ba78@git.apache.org> References: <0f79fc8f6b1b434e94699a3b9e78ba78@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [08/33] ignite git commit: IGNITE-4131 .NET: Improve "Unsupported type exception" with additional information archived-at: Mon, 14 Nov 2016 09:26:16 -0000 IGNITE-4131 .NET: Improve "Unsupported type exception" with additional information Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6a2ecdbf Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6a2ecdbf Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6a2ecdbf Branch: refs/heads/master Commit: 6a2ecdbf5dbc86ff0c25cca579a669e90b3cfffd Parents: a801f01 Author: Pavel Tupitsyn Authored: Fri Oct 28 19:45:29 2016 +0300 Committer: Pavel Tupitsyn Committed: Fri Oct 28 19:45:29 2016 +0300 ---------------------------------------------------------------------- .../Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs | 12 ++++++++++++ .../Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs | 6 +++--- 2 files changed, 15 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/6a2ecdbf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs index 860fd9e..cc5d8a1 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs @@ -1949,6 +1949,18 @@ namespace Apache.Ignite.Core.Impl.Binary } /// + /// Gets the unsupported type exception. + /// + public static BinaryObjectException GetUnsupportedTypeException(Type type, object obj) + { + return new BinaryObjectException(string.Format( + "Unsupported object type [type={0}, object={1}].\nSpecified type " + + "can not be serialized by Ignite: it is neither [Serializable], " + + "nor registered in IgniteConfiguration.BinaryConfiguration." + + "\nSee https://apacheignite-net.readme.io/docs/serialization for more details.", type, obj)); + } + + /// /// Creates and instance from the type name in reader. /// private static T CreateInstance(BinaryReader reader) http://git-wip-us.apache.org/repos/asf/ignite/blob/6a2ecdbf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs index 063aa9d..585ccd3 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs @@ -1259,8 +1259,8 @@ namespace Apache.Ignite.Core.Impl.Binary // Are we dealing with a well-known type? var handler = BinarySystemHandlers.GetWriteHandler(type); - if (handler == null) // We did our best, object cannot be marshalled. - throw new BinaryObjectException("Unsupported object type [type=" + type + ", object=" + obj + ']'); + if (handler == null) // We did our best, object cannot be marshalled. + throw BinaryUtils.GetUnsupportedTypeException(type, obj); if (handler.SupportsHandles && WriteHandle(_stream.Position, obj)) return; @@ -1316,7 +1316,7 @@ namespace Apache.Ignite.Core.Impl.Binary WriteLongField(*(long*)&val0); } else - throw new BinaryObjectException("Unsupported object type [type=" + type.FullName + ", object=" + val + ']'); + throw BinaryUtils.GetUnsupportedTypeException(type, val); } ///