-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #181 from jermdavis/master
Adding a meaningful error message if FakeDb.Serialization encounters a duplicated Item ID
- Loading branch information
Showing
8 changed files
with
142 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using Sitecore.Data; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Sitecore.FakeDb.Serialization | ||
{ | ||
|
||
/// <summary> | ||
/// Exception thrown if the deserialization logic encounters a duplicated content item ID. | ||
/// Ensures that the user gets a meaningful error message to help them debug their serialized content. | ||
/// </summary> | ||
public class DuplicateIdException : ArgumentException | ||
{ | ||
public DuplicateIdException(ID id, string firstFile, string secondFile) | ||
: base(string.Format( | ||
"FakeDb.Serialization is unable to process this content tree.\n\nThe item id {0} defined by item file being processed \"{1}\" has already been used by the item in \"{2}\"", | ||
id, firstFile, secondFile)) | ||
{ | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
...keDb.Serialization.Tests/Data/IncorrectSerialization/master/sitecore/content/ItemOne.item
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
----item---- | ||
version: 1 | ||
id: {108266C2-304B-4AD3-9813-2BE1B88609FF} | ||
database: master | ||
path: /sitecore/content/Item only available in custom serialization folder | ||
parent: {0DE95AE4-41AB-4D01-9EB0-67441B7C2450} | ||
name: Item only available in custom serialization folder | ||
master: {00000000-0000-0000-0000-000000000000} | ||
template: {A87A00B1-E6DB-45AB-8B54-636FEC3B5523} | ||
templatekey: Folder | ||
|
||
----version---- | ||
language: en | ||
version: 1 | ||
revision: 9a93e109-ce03-4f04-95bb-15d6dd3041f3 | ||
|
||
----field---- | ||
field: {25BED78C-4957-4165-998A-CA1B52F67497} | ||
name: __Created | ||
key: __created | ||
content-length: 16 | ||
|
||
20140928T183147Z | ||
----field---- | ||
field: {5DD74568-4D4B-44C1-B513-0AF5F4CDA34F} | ||
name: __Created by | ||
key: __created by | ||
content-length: 14 | ||
|
||
sitecore\admin | ||
----field---- | ||
field: {8CDC337E-A112-42FB-BBB4-4143751E123F} | ||
name: __Revision | ||
key: __revision | ||
content-length: 36 | ||
|
||
9a93e109-ce03-4f04-95bb-15d6dd3041f3 | ||
----field---- | ||
field: {D9CF14B1-FA16-4BA6-9288-E8A174D4D522} | ||
name: __Updated | ||
key: __updated | ||
content-length: 35 | ||
|
||
20140928T183147:635475259073629721Z | ||
----field---- | ||
field: {BADD9CF9-53E0-4D0C-BCC0-2D784C282F6A} | ||
name: __Updated by | ||
key: __updated by | ||
content-length: 14 | ||
|
||
sitecore\admin |
51 changes: 51 additions & 0 deletions
51
...keDb.Serialization.Tests/Data/IncorrectSerialization/master/sitecore/content/ItemTwo.item
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
----item---- | ||
version: 1 | ||
id: {108266C2-304B-4AD3-9813-2BE1B88609FF} | ||
database: master | ||
path: /sitecore/content/Item only available in custom serialization folder | ||
parent: {0DE95AE4-41AB-4D01-9EB0-67441B7C2450} | ||
name: Item only available in custom serialization folder | ||
master: {00000000-0000-0000-0000-000000000000} | ||
template: {A87A00B1-E6DB-45AB-8B54-636FEC3B5523} | ||
templatekey: Folder | ||
|
||
----version---- | ||
language: en | ||
version: 1 | ||
revision: 9a93e109-ce03-4f04-95bb-15d6dd3041f3 | ||
|
||
----field---- | ||
field: {25BED78C-4957-4165-998A-CA1B52F67497} | ||
name: __Created | ||
key: __created | ||
content-length: 16 | ||
|
||
20140928T183147Z | ||
----field---- | ||
field: {5DD74568-4D4B-44C1-B513-0AF5F4CDA34F} | ||
name: __Created by | ||
key: __created by | ||
content-length: 14 | ||
|
||
sitecore\admin | ||
----field---- | ||
field: {8CDC337E-A112-42FB-BBB4-4143751E123F} | ||
name: __Revision | ||
key: __revision | ||
content-length: 36 | ||
|
||
9a93e109-ce03-4f04-95bb-15d6dd3041f3 | ||
----field---- | ||
field: {D9CF14B1-FA16-4BA6-9288-E8A174D4D522} | ||
name: __Updated | ||
key: __updated | ||
content-length: 35 | ||
|
||
20140928T183147:635475259073629721Z | ||
----field---- | ||
field: {BADD9CF9-53E0-4D0C-BCC0-2D784C282F6A} | ||
name: __Updated by | ||
key: __updated by | ||
content-length: 14 | ||
|
||
sitecore\admin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters