Refactored to move Error code to exception package to avoid circular dependencies between packages