Fix ingest running before downloading server files in setup.ps1 - #350
Conversation
WalkthroughThe Changes
Possibly related PRs
Suggested reviewers
Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
setup.ps1 (1)
136-142: Reordering Download Block and Error Handling SuggestionThe new block correctly places the download process before initiating the ingest, which addresses the PR objective of preventing ingest from running before the necessary server files have been downloaded. However, since these downloads are critical for subsequent steps, it would be prudent to add error handling to catch any issues during the download process. This enhancement would help avoid running the ingest phase if a file fails to download.
Suggested improvement:
Wrap theInvoke-WebRequestcalls in a try/catch block. For example:-Write-Host "Downloading customized server files..." -Invoke-WebRequest -Uri "https://github.com/Zintixx/MapleStory2-XML/releases/latest/download/Server.m2d" -OutFile (Join-Path $dataPath "Server.m2d") -Invoke-WebRequest -Uri "https://github.com/Zintixx/MapleStory2-XML/releases/latest/download/Server.m2h" -OutFile (Join-Path $dataPath "Server.m2h") -Invoke-WebRequest -Uri "https://github.com/Zintixx/MapleStory2-XML/releases/latest/download/Xml.m2d" -OutFile (Join-Path $dataPath "Xml.m2d") -Invoke-WebRequest -Uri "https://github.com/Zintixx/MapleStory2-XML/releases/latest/download/Xml.m2h" -OutFile (Join-Path $dataPath "Xml.m2h") +Write-Host "Downloading customized server files..." +try { + Invoke-WebRequest -Uri "https://github.com/Zintixx/MapleStory2-XML/releases/latest/download/Server.m2d" -OutFile (Join-Path $dataPath "Server.m2d") + Invoke-WebRequest -Uri "https://github.com/Zintixx/MapleStory2-XML/releases/latest/download/Server.m2h" -OutFile (Join-Path $dataPath "Server.m2h") + Invoke-WebRequest -Uri "https://github.com/Zintixx/MapleStory2-XML/releases/latest/download/Xml.m2d" -OutFile (Join-Path $dataPath "Xml.m2d") + Invoke-WebRequest -Uri "https://github.com/Zintixx/MapleStory2-XML/releases/latest/download/Xml.m2h" -OutFile (Join-Path $dataPath "Xml.m2h") +} catch { + Write-Host "Error downloading server files: $($_.Exception.Message)" -ForegroundColor Red + exit 1 +}This addition ensures that any failure in downloading the files is caught, and the script halts gracefully instead of proceeding with ingest operations.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
setup.ps1(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: build
Summary by CodeRabbit