Skip to content

Commit

Permalink
Pull out #log_error
Browse files Browse the repository at this point in the history
  • Loading branch information
cheshire137 committed Nov 26, 2024
1 parent 7ba64ae commit 8a03294
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lib/project_pull_mover/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -198,25 +198,28 @@ def any_option_ids?

private

sig { params(message: String).void }
def log_error(message)
@error_message = message
@logger.error(message)
end

sig { returns T::Boolean }
def valid?
unless project_number && project_owner && status_field
@error_message = "Error: missing required options"
@logger.error(@error_message)
log_error("Error: missing required options")
@logger.info(to_s)
return false
end

unless %w(user organization).include?(project_owner_type)
@error_message = "Error: invalid project owner type"
@logger.error(@error_message)
log_error("Error: invalid project owner type")
@logger.info(to_s)
return false
end

unless any_option_ids?
@error_message = "Error: you must specify at least one option ID for the status field"
@logger.error(@error_message)
log_error("Error: you must specify at least one option ID for the status field")
@logger.info(to_s)
return false
end
Expand Down

0 comments on commit 8a03294

Please sign in to comment.