Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide more informative error messages #739

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions bin/antigen.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -824,10 +824,15 @@ antigen-bundle () {

local record="${bundle[url]} ${bundle[loc]} ${bundle[btype]} ${bundle[make_local_clone]}"
if [[ $_ANTIGEN_WARN_DUPLICATES == true && ! ${_ANTIGEN_BUNDLE_RECORD[(I)$record]} == 0 ]]; then
printf "Seems %s is already installed!\n" ${bundle[name]}
if [[ ${bundle[loc]} == "/" ]]; then
printf "Antigen: Seems %s %s is already installed!\n" ${bundle[btype]} ${bundle[name]}
else
local local_name=${bundle[loc]#plugins/}
printf "Antigen: Seems %s %s from %s is already installed!\n" ${bundle[btype]} ${local_name} ${bundle[name]}
fi
return 1
fi

# Clone bundle if we haven't done do already.
if [[ ! -d "${bundle[dir]}" ]]; then
if ! -antigen-bundle-install ${(kv)bundle}; then
Expand All @@ -838,10 +843,15 @@ antigen-bundle () {
# Load the plugin.
if ! -antigen-load ${(kv)bundle}; then
TRACE "-antigen-load failed to load ${bundle[name]}" BUNDLE
printf "Antigen: Failed to load %s.\n" ${bundle[btype]} >&2
if [[ ${bundle[loc]} == "/" ]]; then
printf "Antigen: Failed to load %s %s.\n" ${bundle[btype]} ${bundle[name]}
else
local local_name=${bundle[loc]#plugins/}
printf "Antigen: Failed to load %s %s from %s.\n" ${bundle[btype]} ${local_name} ${bundle[name]}
fi
return 1
fi

# Only add it to the record if it could be installed and loaded.
_ANTIGEN_BUNDLE_RECORD+=("$record")
}
Expand All @@ -864,13 +874,13 @@ antigen-bundle () {

if ! -antigen-ensure-repo "${bundle[url]}"; then
# Return immediately if there is an error cloning
TRACE "-antigen-bundle-instal failed to clone ${bundle[url]}" BUNDLE
printf "Error! Activate logging and try again.\n" >&2
TRACE "-antigen-bundle-install failed to clone ${bundle[url]}" BUNDLE
printf "Antigen: Error! Activate logging and try again.\n" >&2
return 1
fi

local took=$(( $(date +'%s') - $start ))
printf "Done. Took %ds.\n" $took
printf "Antigen: Done. Took %ds.\n" $took
}
antigen-bundles () {
# Bulk add many bundles at one go. Empty lines and lines starting with a `#`
Expand Down
24 changes: 17 additions & 7 deletions src/commands/bundle.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,15 @@ antigen-bundle () {

local record="${bundle[url]} ${bundle[loc]} ${bundle[btype]} ${bundle[make_local_clone]}"
if [[ $_ANTIGEN_WARN_DUPLICATES == true && ! ${_ANTIGEN_BUNDLE_RECORD[(I)$record]} == 0 ]]; then
printf "Seems %s is already installed!\n" ${bundle[name]}
if [[ ${bundle[loc]} == "/" ]]; then
printf "Antigen: Seems %s %s is already installed!\n" ${bundle[btype]} ${bundle[name]}
else
local local_name=${bundle[loc]#plugins/}
printf "Antigen: Seems %s %s from %s is already installed!\n" ${bundle[btype]} ${local_name} ${bundle[name]}
fi
return 1
fi

# Clone bundle if we haven't done do already.
if [[ ! -d "${bundle[dir]}" ]]; then
if ! -antigen-bundle-install ${(kv)bundle}; then
Expand All @@ -30,10 +35,15 @@ antigen-bundle () {
# Load the plugin.
if ! -antigen-load ${(kv)bundle}; then
TRACE "-antigen-load failed to load ${bundle[name]}" BUNDLE
printf "Antigen: Failed to load %s.\n" ${bundle[btype]} >&2
if [[ ${bundle[loc]} == "/" ]]; then
printf "Antigen: Failed to load %s %s.\n" ${bundle[btype]} ${bundle[name]}
else
local local_name=${bundle[loc]#plugins/}
printf "Antigen: Failed to load %s %s from %s.\n" ${bundle[btype]} ${local_name} ${bundle[name]}
fi
return 1
fi

# Only add it to the record if it could be installed and loaded.
_ANTIGEN_BUNDLE_RECORD+=("$record")
}
Expand All @@ -56,11 +66,11 @@ antigen-bundle () {

if ! -antigen-ensure-repo "${bundle[url]}"; then
# Return immediately if there is an error cloning
TRACE "-antigen-bundle-instal failed to clone ${bundle[url]}" BUNDLE
printf "Error! Activate logging and try again.\n" >&2
TRACE "-antigen-bundle-install failed to clone ${bundle[url]}" BUNDLE
printf "Antigen: Error! Activate logging and try again.\n" >&2
return 1
fi

local took=$(( $(date +'%s') - $start ))
printf "Done. Took %ds.\n" $took
printf "Antigen: Done. Took %ds.\n" $took
}