/// Describes an optional action that is only executed if an Ok result
/// was returned (used in collect_or_pass_error);
/// Handles a generic Result with an SpannedCompilerError error.
/// If the result is Ok(), an Ok(MaybeAction::Do) with the result is returned
/// If result is Error() and collected_errors is Some, the error is appended to the collected_errors
/// and an Ok(MaybeAction::Skip) is returned
/// If result is Error() and collected_errors is None, the error is directly returned