#[error_code]
pub enum ErrorCode {
#[msg("Course is not active")]
CourseNotActive,
#[msg("Already enrolled")]
AlreadyEnrolled,
#[msg("Insufficient XP")]
InsufficientXP,
}
Use with: require!(course.is_active, ErrorCode::CourseNotActive);