Created
May 29, 2012 20:36
-
-
Save luckyllama/2830567 to your computer and use it in GitHub Desktop.
Exceptions
This file contains hidden or 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
| using Intermark.Tam.Data.Contracts.Exceptions; | |
| namespace Intermark.Tam.Data.Dependency | |
| { | |
| public static class DatabaseExceptionHelper | |
| { | |
| /// <exception cref="DuplicateRecordDatabaseError"><c>DuplicateRecordDatabaseError</c>.</exception> | |
| /// <exception cref="UpdatedRecordNotExistDatabaseError"><c>UpdatedRecordNotExistDatabaseError</c>.</exception> | |
| /// <exception cref="InvalidLanguageTokenDatabaseError"><c>InvalidLanguageTokenDatabaseError</c>.</exception> | |
| /// <exception cref="InvalidAssetTypeDatabaseError"><c>InvalidAssetTypeDatabaseError</c>.</exception> | |
| /// <exception cref="InvalidOutlineDatabaseError"><c>InvalidOutlineDatabaseError</c>.</exception> | |
| /// <exception cref="InvalidAssetValueDatabaseError"><c>InvalidAssetValueDatabaseError</c>.</exception> | |
| /// <exception cref="InvalidCollectionDatabaseError"><c>InvalidCollectionDatabaseError</c>.</exception> | |
| /// <exception cref="InvalidComponentDatabaseError"><c>InvalidComponentDatabaseError</c>.</exception> | |
| /// <exception cref="InvalidOutlineComponentDatabaseError"><c>InvalidOutlineComponentDatabaseError</c>.</exception> | |
| /// <exception cref="ConfilctedComponentAndAssetTypeDatabaseError"><c>ConfilctedComponentAndAssetTypeDatabaseError</c>.</exception> | |
| /// <exception cref="CannotDeactivateCollectionDatabaseError"><c>CannotDeactivateCollectionDatabaseError</c>.</exception> | |
| /// <exception cref="InvalidDisplayOutlineDatabaseError"><c>InvalidDisplayOutlineDatabaseError</c>.</exception> | |
| /// <exception cref="CannotDeactivateDisplayCollectionDatabaseError"><c>CannotDeactivateDisplayCollectionDatabaseError</c>.</exception> | |
| /// <exception cref="InvalidPageDatabaseError"><c>InvalidPageDatabaseError</c>.</exception> | |
| /// <exception cref="InvalidTemplateDatabaseError"><c>InvalidTemplateDatabaseError</c>.</exception> | |
| /// <exception cref="CannotDeactivateAssetDatabaseError"><c>CannotDeactivateAssetDatabaseError</c>.</exception> | |
| /// <exception cref="UnexpectedDatabaseError"><c>UnexpectedDatabaseError</c>.</exception> | |
| /// <exception cref="InvalidPageTemplateDatabaseError"><c>InvalidPageTemplateDatabaseError</c>.</exception> | |
| /// <exception cref="InvalidTemplateOutlineDatabaseError"><c>InvalidTemplateOutlineDatabaseError</c>.</exception> | |
| /// <exception cref="ConfilctedPageTemplateWithActiveOnDatabaseError"><c>ConfilctedPageTemplateWithActiveOnDatabaseError</c>.</exception> | |
| /// <exception cref="InvalidExternalEntityTypeDatabaseError"><c>InvalidExternalEntityTypeDatabaseError</c>.</exception> | |
| /// <exception cref="InvalidExternalEntityKeyDatabaseError"><c>InvalidExternalEntityKeyDatabaseError</c>.</exception> | |
| /// <exception cref="ConfilctedOutlineBetweenExternalEntityTypeAndCollectionDatabaseError"><c>ConfilctedOutlineBetweenExternalEntityTypeAndCollectionDatabaseError</c>.</exception> | |
| /// <exception cref="CannotActivateExternalEntityCollectionDatabaseError"><c>CannotActivateExternalEntityCollectionDatabaseError</c>.</exception> | |
| /// <exception cref="CannotDeactivateExternalEntityCollectionDatabaseError"><c>CannotDeactivateExternalEntityCollectionDatabaseError</c>.</exception> | |
| /// <exception cref="DuplicateCollectionActiveDateAndPriorityDatabaseError"><c>DuplicateCollectionActiveDateAndPriorityDatabaseError</c>.</exception> | |
| public static void ClassifiedDatabaseError(int errorCode, string errorMessage) | |
| { | |
| switch (errorCode) | |
| { | |
| case 2: | |
| throw new DuplicateRecordDatabaseError(errorMessage); | |
| case 3: | |
| throw new UpdatedRecordNotExistDatabaseError(errorMessage); | |
| case 4: | |
| throw new InvalidLanguageTokenDatabaseError(errorMessage); | |
| case 5: | |
| throw new InvalidAssetTypeDatabaseError(errorMessage); | |
| case 6: | |
| throw new InvalidOutlineDatabaseError(errorMessage); | |
| case 7: | |
| throw new InvalidAssetValueDatabaseError(errorMessage); | |
| case 8: | |
| throw new InvalidCollectionDatabaseError(errorMessage); | |
| case 9: | |
| throw new InvalidComponentDatabaseError(errorMessage); | |
| case 10: | |
| throw new InvalidOutlineComponentDatabaseError(errorMessage); | |
| case 11: | |
| throw new ConfilctedComponentAndAssetTypeDatabaseError(errorMessage); | |
| case 12: | |
| throw new CannotDeactivateCollectionDatabaseError(errorMessage); | |
| case 14: | |
| throw new InvalidDisplayOutlineDatabaseError(errorMessage); | |
| case 15: | |
| throw new CannotDeactivateDisplayCollectionDatabaseError(errorMessage); | |
| case 16: | |
| throw new InvalidPageDatabaseError(errorMessage); | |
| case 17: | |
| throw new InvalidTemplateDatabaseError(errorMessage); | |
| case 18: | |
| throw new CannotDeactivateAssetDatabaseError(errorMessage); | |
| case 19: | |
| throw new InvalidPageTemplateDatabaseError(errorMessage); | |
| case 20: | |
| throw new InvalidTemplateOutlineDatabaseError(errorMessage); | |
| case 21: | |
| throw new ConfilctedPageTemplateWithActiveOnDatabaseError(errorMessage); | |
| case 22: | |
| throw new InvalidExternalEntityTypeDatabaseError(errorMessage); | |
| case 23: | |
| throw new InvalidExternalEntityKeyDatabaseError(errorMessage); | |
| case 24: | |
| throw new ConfilctedOutlineBetweenExternalEntityTypeAndCollectionDatabaseError(errorMessage); | |
| case 25: | |
| throw new CannotActivateExternalEntityCollectionDatabaseError(errorMessage); | |
| case 26: | |
| throw new CannotDeactivateExternalEntityCollectionDatabaseError(errorMessage); | |
| case 27: | |
| throw new DuplicateCollectionActiveDateAndPriorityDatabaseError(errorMessage); | |
| case 28: | |
| throw new DuplicateCollectionActiveDateForExternalEntityKeyDatabaseError(errorMessage); | |
| case 29: | |
| throw new CannotActivatePageTemplateWithoutAssignmentDatabaseError(errorMessage); | |
| case 30: | |
| throw new CannotDeactivatePageTemplateDatabaseError(errorMessage); | |
| case 31: | |
| throw new CannotInactivateBeforeActivateDisplayCollectionDatabaseError(errorMessage); | |
| default: | |
| throw new UnexpectedDatabaseError(errorMessage); | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment