Awesome Reviewers expert instructions

domains / / nodejs/node

Standardize null pointer checks

Always use standard null-checking patterns like CHECK_NOT_NULL for pointer validation instead of manual null checks. This ensures consistent error handling and improves code readability. For functions that may return null objects, consider using wrapper types like MaybeLocal to properly propagate null states.

raw .md Null Handling Other

Always use standard null-checking patterns like CHECK_NOT_NULL for pointer validation instead of manual null checks. This ensures consistent error handling and improves code readability. For functions that may return null objects, consider using wrapper types like MaybeLocal to properly propagate null states.

Example:

// Incorrect - manual null check
if (network_resource_manager_ == nullptr) {
  return protocol::DispatchResponse::ServerError("...");
}

// Correct - using standard macro
CHECK_NOT_NULL(network_resource_manager_);

// Correct - using MaybeLocal for nullable returns
MaybeLocal<Object> CreateObject(Isolate* isolate) {
  if (some_condition) return MaybeLocal<Object>();  // Return empty handle
  return Object::New(isolate);
}